Hello, I installed conda using sudo dnf install conda. I closed my shell and even restarted my system. I also tried conda init, conda activate and conda activate base and restarting again. When I launch my shell I get (base) wiking@walhalla:~$ .
However, when I try conda install numpy I get this error message:
usr/lib/python3.13/site-packages/conda/gateways/logging.py:66: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in staticmethod() if you want to preserve the old behavior
record.msg = self.TOKEN_REPLACE(record.msg)
NoBaseEnvironmentError: This conda installation has no default base environment. Use
'conda create' to create new environments and 'conda activate' to
activate environments.
If I do conda env list I get
(base) wiking@walhalla:~$ conda env list
# conda environments:
#
base * /usr
Maybe something is wrong with the path; /usr doesn’t look like a good place to store anything.
If I do conda create -n base is it okay that it wants to create the base environment at /usr? This seems like an odd place to put it. Should I proceed with that or put it somewhere else?
Anywhere else would be better. If it is just to be used by your account, something like ~/envs would probably be fine. If you expect multiple users to share an environment, you might want to put it somewhere like /opt/conda-v24.
It looks like there is some documentation for setting up environments for conda here:
Did I abort this in time? I nearly created the environment in /usr before I checked with y’all first:
(base) wiking@walhalla:~$ conda create -n base
WARNING: A directory already exists at the target location '/usr'
but it is not a conda environment.
Continue creating environment (y/[n])? y
Channels:
- conda-forge
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /usr
Proceed ([y]/n)? n
/usr/lib/python3.13/site-packages/conda/gateways/logging.py:66: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in staticmethod() if you want to preserve the old behavior
record.msg = self.TOKEN_REPLACE(record.msg)
CondaSystemExit: Exiting.
I wouldn’t expect that to be able to overwrite any system files if you were running it as a normal user.
You might try something like rpm -qa | grep '^conda' | xargs rpm -V to see if it shows any modified system packages (no news is good news). If you do see that some files under /usr have been modified, use rpm -qf <path-to-file> to find out which package the file belongs to and then reinstall the package with dnf reinstall <package-name>.
Yes, those are files that have been overwritten, not directories. Use rpm -qf /usr/bin/conda and rpm -qf /usr/bin/conda-env to find out what packages they belong to and then use sudo dnf reinstall <pacakge-name> to replace them with the correct system versions. Then you can re-run that rpm -qa | grep '^conda' | xargs rpm -V command to verify that all the files are back to normal.
I’d go with the second one. I don’t see any reason to make the path any longer than necessary.
Also, you don’t need to pre-create the directory unless you intend to do something fancy with the permissions (e.g. setting a group sticky bit because you have changed the default umask for users to something like 0027 or 0007; with the Fedora Linux default of 0022, however, a group sticky bit should not be needed)
Edit: On second thought, maybe you do need to pre-create the directory just to grant your user account access to it (e.g. sudo chown $USER: /opt/conda-v24). Then you should be able to run the rest of the conda commands as your normal user account and not risk overwriting any system files.
If conda is upgradeed beyond v24 won’t the name conda-v24 no longer make sense? I would assume the environment files would still stay in the same place even if conda itself were upgraded.
So is there any reason not to do this instead?
cd /opt
sudo mkdir conda
sudo chown $USER: /opt/conda
conda create --prefix ./conda -n base
I’m not a conda user, but I think the idea is that your are supposed to run something like the following:
$ cd /opt/conda/bin
$ ./conda init bash
And that is supposed to alter your ~/.bashrc so that your custom conda environment will be found instead of the “base” (system) environment. You could manually move whatever that conda init bash command adds to your ~/.bashrc to a new file under /etc/profile.d if you want those settings applied for all users.
Yes, I think that is how it is supposed to work. I’m not sure though. I dabbled with conda once some time ago, but I haven’t used it since and I don’t remember much about how to set up the environment (other than not to store things under /usr).
Aren’t there other arguments that are needed if I want the environment to have anything installed in it (for example python=3.9 jupyterlab=3.2 matplotlib=3.5 numpy=1.21)?
I guess I can experiment with the default environment and delete it and recreate it if it’s not working for me.
Don’t I need to at least specify the Python version though?