I wanted to install pytorch on my fedora, and they suggested simple command
‘conda install pytorch torchvision cudatoolkit=10.0 -c pytorch’
Unfortunately, that completely broke my os. DNF stopped working, everything stopped working. Reinstalling system would remove my home directory and every setting i have done so far so I am trying to find way around.
if i type “python” I am getting “Anaconda” version, not “Red-Hat”. Is there a way of removing Anaconda at this stage ?
Did you install Anaconda on system level? To run DL frameworks like PyTorch I think it’s best to install in your home… Even so, I think at the end of the installation one is asked whether conda may modify .bashrc (assuming you install in your user’s location). Perhaps in your case, these entries ended up in root’s bashrc, or even /etc/bashrc?
I’d try locating these entries and commenting/removing them, and see if that gets your system back to normal again…
Welcome to the community @tmdag. Please take a minute to go through the posts in the #start-here category if you have not had the chance.
Can you tell us how you installed
conda? Was it from the repositories?
As @skeydan said,
conda simply sets up a virtual environment. So, if you only used
conda install ..., it should not have touched your system files at all. You are simply still in the conda virtual environment, and that is making the system libraries and tools like
dnf unavailable. What does this command say?
Hopefully, it’ll list the active environment in the first line. We should be able to deactivate that environment and that should get you back to the system installation of Python etc.
More information on conda and environments is here:
If you install
conda from the Fedora repositories using
dnf install conda, it should not do this. You have to manually create a new environment and then work there—this is done on purpose to ensure that the conda bits do not clash with the system files.
@FranciscoD oh, right! For some historical reason I’ve been installing Anaconda using their installer, but I really should switch to the Fedora repo
@FranciscoD thanks! I will definitely go through those!
I do not recall heaving conda previously installed, All I did is run suggested command.
The pytorch installation was not progressing due to lack of permissions, so I gave it a sudo.
I’m using tcsh and I do not see any anaconda installations in my home directory nor changes to my .tcshrc - hence that might (?) be the issue.
even GCC version was showing “Anaconda” instead of “Red-Hat”. I ended up reinstalling system.
Just as a side note: in general, you want dnf to manage your Python packages as much as possible. Stuff like conda and pip should never be run as sudo, because (as you’ve somewhat experienced) they have a tendency to override system Python libraries and cause trouble.
For pytorch, you can probably use virtualenvs which provide the same or better isolation as conda does. I personally use a mix of Poetry and virtualenvwrapper for all my Python stuff.
Ah, that would fix it
As @refi64 notes, you should install conda, set up a new environment and then install pytorch etc in that environment only. If it requries
sudo (shouldn’t really), then you should still use a different environment and put these installations in a different folder in
/opt. I.e., do not let them override system files that are managed by dnf/rpm—that’ll break other things on your system.
I’ve not installed pytorch in a while. If you run into issues installing it in a virtual environment, please ask a fresh question and we can see how to manage it.