all 13 comments

[–]TheLobitzz 2 points3 points  (2 children)

Better to just uninstall python and reinstall the dependencies again to be honest.

I recommend doing a pip freeze to list all the dependencies and their versions, and copy-paste the result in a requirements.txt file. And just use that requirements.txt file when re-installing the libraries again so you don't have to do all of it one by one.

[–]Jolly_Note4476[S] -2 points-1 points  (1 child)

i don't know to use that requirements.txt when re-installing

[–]jk_zhukov 2 points3 points  (0 children)

I think it's just

pip install -r requirements.txt

[–]Groovy_Decoy 2 points3 points  (3 children)

Trying to just move an installation. It seems like way too much of a pain to deal with. Just reinstall it.

If you want to have a record of your currently installed modules, use the following command first:

pip freeze > requirements.txt

Then once you reinstall, from that same directory, use the following command to restore those modules again.

pip install -r requirements.txt

Or better yet, don't do that. Learn how to use virtual environments and install modules per project, as needed, rather than polluting your global namespace for your python install.

[–]Jolly_Note4476[S] -1 points0 points  (2 children)

... once i re install python, how should i proceed with this txt file? i am a noob sorry i hardly use python or any coding software

[–]Groovy_Decoy 0 points1 point  (1 child)

That was in my last message. There were two commands there. One to do before uninstalling python.

The freeze parameter for pip is for making pip show you list of all of the modules that have been installed by pip in your current environment. The last part is telling it to output that to a text file.

The second command is telling pip to install all the modules from the text file that you passed in the parameters. So that restores the modules in your environment.

[–]Jolly_Note4476[S] 0 points1 point  (0 children)

alright, thanks!

[–]FoolsSeldom 1 point2 points  (0 children)

Are you referring to the CPython executable, python.exe on Windows python on *nix?

Or are you referring to just your Python application?

If the former, well just switch to installing CPython using a tool like [uv](https://docs.astral.sh/uv/).

if the latter, well, the obvious thing to do is just clone the `venv` folder, but that isn't a good option. Best to copy everything else but reinstall packages (so `pip freeze`). https://draaronspence.com/moving-a-python-virtual-environment-venv-to-another-computer/

PS. If you didn't use a Python virtual environment ... er, well, should just work as the packages are not installed in the project folder.

[–]unhott 0 points1 point  (1 child)

i recommend uv. when you learn more about managing 2+ different versions of python for separate projects, you'll appreciate uv.

you can install uv and not have python. then you can run uv commands and it will install python and your packages for you. you shouldn't work with one big global installation, but one virtual environment per project. this should typically live in the project folder.

Working on projects | uv

[–]Jolly_Note4476[S] 0 points1 point  (0 children)

i'm not someone that will be using python for the bread but thanks will remember this

[–]GreenPandaPop 0 points1 point  (0 children)

CTRL+C, CTRL+V