Conda installs a package that already exists - python

Although I already have numpy installed in my anaconda environment as per conda list
numpy 1.15.4 pypi_0 pypi
numpy-base 1.16.2 py36hc3f5095_0
numpydoc 0.8.0 py36_0
However, when I did conda install theano, it tries to install another numpy package with the same version as shown below
added / updated specs:
- theano
The following NEW packages will be INSTALLED:
mkl_fft pkgs/main/win-64::mkl_fft-1.0.10-py36h14836fe_0
numpy pkgs/main/win-64::numpy-1.16.2-py36h19fb1c0_0
pygpu pkgs/main/win-64::pygpu-0.7.6-py36h452e1ab_0
scipy pkgs/main/win-64::scipy-1.2.1-py36h29ff71c_0
theano pkgs/main/win-64::theano-1.0.3-py36_0
My questions are:
why do I have different versions of numpy (numpy 1.15.4 and numpy-base 1.16.2)?
why does anaconda want to install a second numpy package of the same version in its environment?
Thanks.

why do I have different versions of numpy (numpy 1.15.4 and numpy-base 1.16.2)?
If you open Conda terminal and from numpy import __version__ you will probably see that the version is equal to 1.16.2. But if you open python externally to the Conda, and do the same thing you will probably see the version 1.15.4. Conda by default maintains the base environment and, as each environment can have its own version of each module, the difference is because of that.
why does anaconda want to install a second numpy package of the same
version in its environment?
This can be explained if you have another active environment (different from the base environment), and the first answer also answers this.

Related

"torch" and "pytorch" version mismatch in conda

I installed the following in an environment:
cudatoolkit=11.3
pytorch=1.11.0
torchvision=0.12.0
But when asking for the torch/cuda version I get this:
$ python3 -c "import torch; print(torch.__version__)"
1.12.1+cu102
Which is not what I want (1.12.1 would be fine, but cu102 is too old). Looking further, I see this:
$ conda list torch
# packages in environment at /home/ml/anaconda3/envs/ldm:
#
# Name Version Build Channel
pytorch 1.11.0 py3.8_cuda11.3_cudnn8.2.0_0 pytorch
pytorch-lightning 1.4.2 pypi_0 pypi
pytorch-mutex 1.0 cuda pytorch
torch 1.12.1 pypi_0 pypi
torch-fidelity 0.3.0 pypi_0 pypi
torchdiffeq 0.2.3 pypi_0 pypi
torchmetrics 0.6.0 pypi_0 pypi
torchvision 0.12.0 py38_cu113 pytorchcode
So "pytorch" has the version I want (with cuda11.3), but "torch" is 1.12.1. Why? Moreover, "torch" does not seem to be a conda package (PackagesNotFoundError when trying to install), which is surprising since it appears in "conda list".
There is clearly something I do not understand about conda / pytorch. Can someone please explain it?
From what I know, the torch package uses the LuaRocks Package manager. And if you use it mostly in python, you should aim for 'PyTorch', which conda only takes care of.
For your case, I strongly suggest you create a new environment and start again installing PyTorch and it's components from the beginning. Read this compatibility matrix and try to install it according to those tables.
So in the end that "torch" fake (?) package was my previous install of pytorch and cuda (with pip). The conda install actually made the pip one not work anymore ("import torch" was not working outside of the environment). Which is even weirder since my understanding of virtual environment was that it should at the very least not affect what's outside.
The solution was to reinstall pytorch with pip (outside the environment). After that, "import torch" worked inside the environment. Which again is weird since conda installed his own version of pytorch, apparently not to use it in the end.
I consider this an "answer" as it solves the problem I was having, but I still don't understand why conda behaved this way.

When a module is uninstalled on a virtual environment, does it remain uninstalled outside the virtualenv?

I have numpy 1.16 installed due to it being listed as the specific version that ought to be used for a program to function properly. After installing numpy 1.19 in a virtual environment, I noticed the following messages:
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.16.6
Uninstalling numpy-1.16.6:
Successfully uninstalled numpy-1.16.6
Will numpy 1.16 remain when I deactivate the virtual environment or will I have to reinstall it with pip once I finish using version 1.19?
Thank you.
If you installed numpy 1.16 for a specific virtual environment and replaced it with 1.9 it will not be there in the virtual environment but you will not need pip install for future use in other projects.
Which means it will not be uninstalled outside of the virtualenv.

Cannot find numpy module

I am trying to run a python file which needs numpy as an import.
I have set up an environment where numpy is installed via Anaconda. I am also using pypy, and when I try to run the file using
pypy myFile.py
I get the following error
ImportError: No module named numpy
I then run pip list to check the packages currently installed in the enivornment and numpy is there
certifi 2018.11.29
mkl-fft 1.0.10
mkl-random 1.0.2
numpy 1.15.4
pip 19.0.1
setuptools 40.8.0
wheel 0.32.3
wincertstore 0.2
I'm not sure why it is not finding numpy, any help is appreciated, thanks
If you used conda to install Numpy, you probably installed a version that is not compatible with pypy. Use pip instead. Jump into your virtual environment and:
conda uninstall numpy
pip install numpy

Uninstallation issues in python numpy

I am in the process of downgrading numpy1.13 to 1.7. In order to do this, I am uninstalling the latest version so that i can install with a older version,
I have uninstalled numpy in anaconda python using
`pip uninstall numpy`
After uninstalling, when i see the conda list, numpy is still listed in the library list.
When i tried again with pip uninstall numpy, its throwing me an errors as "cannot uninstall requirement numpy, not installed".`
Any help on this is much appreciated.
Thank you .
try this if you are using anaconda:
conda uninstall numpy
conda install numpy=1.7
or this if you are using python pip:
pip uninstall numpy
pip install numpy==1.7
The following commands works for me to uninstall
pip3 uninstall numpy
pip uninstall numpy
Then, for installing
pip install numpy
Anaconda is a package manager for python, you can install in anaconda environment either by conda or by pip. Uninstalling a package depends on how you installed the package.
When you run the conda list command yo get output like below
# packages in environment at C:\Anaconda3\envs\base:
#
# Name Version Build Channel
astroid 2.4.2 pypi_0 pypi
ca-certificates 2020.6.20 hecda079_0 conda-forge
certifi 2020.6.20 py36h9f0ad1d_0
colorama 0.4.3 pypi_0 pypi
django 2.2 py36_0
djangorestframework 3.11.0 py_0 conda-forge
libblas 3.8.0 15_mkl conda-forge
numpy 1.18.4 py36h4d86e3b_0 conda-forge
openssl 1.1.1g he774522_0 conda-forge
you can check the channel from which you have installed the dependency. If you installed a package via conda it is safe to uninstall using conda only

Can't update to numpy 1.13 with anaconda?

PyPI has numpy 1.13.3 packages for a month now https://pypi.python.org/pypi/numpy
Anaconda cloud claims to have 1.13 https://anaconda.org/anaconda/numpy
But I just get 1.11.3-py35_0 when I use conda update numpy
My environment: Windows 7 64 bit python 3.5
You could try to install a specific NumPy version. In your case you could use:
$ conda install numpy=1.13
In case of conflicts it will show the conflicting packages.
For example:
$ conda install numpy=1.14
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- blaze -> numba -> numpy[version='>=1.13,<1.14.0a0']
- numpy=1.14
Use "conda info <package>" to see the dependencies for each package.
In this case blaze and numba prevent NumPy from upgrading.
I had the same problem and none of them worked!
So I solved it using command:
pip install --upgrade numpy
Then, when I ls to my site-packages dir, I see it's updated to 1.14.0.

Categories