Python Virtual Environment: changed path of enviroment - can't find packages anymore (How to show the enviroment where its packages are located)

Viewed 30

I have a issue with my virutal enviroment and I couldn't find a clear and straightforward awnser for it.

I had a fully working virtual enviroment with a lot of packages. My directory changed from "../Desktop/.." to "../Cloud_Name/Desktop/.." and lets assume i can't change that anymore.

I'm now able to cd into my eviroment and activate it.
If I now want to use any kind of command I get:

Fatal error in launcher: Unable to create process using "C: ..." "C: ..." the system cannot find the specified file.

I tried sofar to change the directory in "eviroment/Scripts/activate" and "eviroment/Scripts/activate.bat", but it doesn't work.
I don't want to install a new enviroment.
I'd be very thankfull if someone has a working solution to show my eviroment where its packages are.

Thank you in advance for your time and have a great day!

1 Answers

If you are able to activate your virtual environment, I suggest storing the installed packages (their names and version) into a requirements file by running pip freeze > requirements.txt Then recreate a new environment. After which you can reinstall your previous packages through pip install -r requirements.txt.

Virtualenv usually creates a symbolic link to reference package locations and I think after you changed the location of the environments, it did not (though it usually does not) update the symbolic links to the new location.

Related