Ask coding questions

← Back to all posts
Having to run install-pkg every time
BruceLi2

I took some code that renders images into graphs on desmos. The repl is written in Python, and sometimes when it starts it gives an error install pypotrace, one of the dependencies. The thing is, if I run $install-pkg python3-dev python3-pip build-essential libagg-dev libpotrace-dev pkg-config wheel in the shell, it installs fine. After a while, it would fail to install and I would have to re-run the install-pkg command. Does anyone know how to fix this?

(p.s. it shows internal server error because the app isn't supposed to be accessed directly from a web browser, and it has nothing to do with the problem. The problem prevents the script from starting.)

Answered by Highwayman [earned 5 cycles]
View Answer
Voters
BruceLi2
Comments
hotnewtop
Highwayman

have you tried installing the package into the main repl dir that's always saved and linking there instead so that you're not having to reinstall every time?

BruceLi2

@Highwayman I ran the install-pkg command in the main dir every time, so I don't know why it's not working. I guess I can use something thats gonna keep it up so it doesn't reset.

Highwayman

the install-pkg command itself doesn't save the package to the main dir, it saves it to ~/.apt/packages or whatever. you need to move it out of that dir and into the main ones. @BruceLi2

BruceLi2

inside the .apt are 4 folders, etc, lib, var, and usr. Would I move all 4 and would the dir be ~ or ~/not-a-desmos-rickroll?

Also, when I tried moving them into ~ and /not-a-desmos-rickroll, it still threw errors when I ran the app until I re-ran the command. @Highwayman

Highwayman

It's the second one, but you not only have to move it there but also change how you access it in your code, like you'd have to access it like a normal separate file.

@BruceLi2

BruceLi2

I'm a little bit confused, but when the repl starts it automatically tries to install the packages using python3 -m poetry install, and requires packages from ~.apt/ which are removed by repl whenever it restarts. I might be wrong, but I don't think the actual python scripts need the packages. @Highwayman

Highwayman

hm... maybe try running the real without them then? try making a .replit file and just do the python command there maybe so that it doesn't unnecessarily install the packages. @BruceLi2

BruceLi2

ok, I'll try that. When I tried to make a .replit before it didn't seem to work, but I'll try again. What I found is that once is save the .apt folder into the repl's dir, I can just do cp -r .apt ~and it will install correctly. Thanks. @Highwayman

BruceLi2

I added a .replit file that contains
run = "cp -r ~/repl-name/.apt ~ && python3 main.py" and it works! thanks man :)@Highwayman

Highwayman

heh that's a lot more clever than anything I was thinking of, happy that worked out. :) @BruceLi2