How to uninstall a single packages in anaconda? - python

I'm trying to uninstall numpy & then install a specific version of it on anaconda. However, the prompt also told that others packages will also uninstall itself. How do I uninstall only numpy packages? I'm using ubuntu 18.04.

If you anaconda contain pip tool, you can uninstall numpy only through pip uninstall numpy

Related

how to change numpy version with miniforge

I have installed miniforge on my mac , in that using a 'local env' on jupyter notebook. I can't change the numpy version (need to downgrade to 1.19.5) on this kernel, have tried:
(1)pip install numpy==1.19.5 &
(2)conda install -c conda-forge numpy=1.19.5.
numpy version seems to be changing easily on conda-ipython3 kernel, but my project is running on 'local env'
very new to all this, still learning. Please help
first make sure that your local environment is activated by running: .../{your venv folder path}/Scripts/activate. Because if you install numpy on the wrong virtual environment then it won't work.
Then uninstall numpy by running pip uninstall numpy. Then install the numpy version you want.
You can do the following to ensure you have desired numpy version:
Activate your local environment
Uninstall any previously installed numpy version by using:
pip uninstall numpy
Install the desired numpy version:
pip install numpy=1.19.5
Check the installed version of numpy:
pip freeze
If you want to export the package list use:
pip freeze > requirements.txt

numpy library in Anaconda

I installed anaconda and pycharm. I was working on juypter. I installed numpy but when I am running my program in jupyter then its showing that 'there is a problem in importing numpy libraries, first uninstall it and then install again'. can anyone help me that why this error is and how I can uninstall numpy in anaconda and how again correctly I can install it?? and do I need to install it in a specific drive?
ImportError: Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['C:\ProgramData\Anaconda2\lib\site-packages\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
Anaconda comes with Python and 100+ popular packages, including numpy. My guess is that you used pip to install another copy of numpy into your Anaconda installation.
You can check by running:
pip freeze
If you see two copies of numpy, you have a problem. You can try to uninstall it using
pip uninstall numpy
But my guess is that it may break your installation. Your best bet is to uninstall and reinstall Anaconda. (You should also consider upgrading to Anaconda3 with Python 3.).
Going forward, if you are going to use Anaconda, you should use Conda to install packages whenever possible. I.e.
conda install numpy

Does Python come with numpy library as default

Does python come with numpy library as default or do you have to install it after installing python?
Python doesn't come with numpy installed. However it could have been installed as requirement while installing other packages.
You could install it via pip:
pip install numpy
Or, you could check the list of the installed packages and their version via pip:
pip list

Cannot uninstall Tensorflow

The following image shows various versions of tensorflow installed however I am not able to uninstall it.
I tried pip, pip3, conda and still it does not recognise tensorflow.
I even tried all the possibilities from this thread Tensorflow: why 'pip uninstall tensorflow' cannot find tensorflow
How to remove Tensorflow completely ?
Did you try uninstalling by removing protobuf first and then tensorflow
sudo pip uninstall protobuf
sudo pip uninstall tensorflow
And most probably you didn't installed tensorflow via conda that's why you were getting that error(package not found)
To figure out which package was used to install the particular package you can list using the following command
conda list
pip list
. ...etc
And use appropriate command to uninstall the package
Try
pip uninstall tensorflow-cpu
or
pip uninstall tensorflow-gpu
Try "pip uninstall tensorflow-___" at the place of dashes add CPU or gpu according to the build that you have installed.
You can delete any python package that was installed globally, manually by going into your global site-packages folder and deleting the files manually.
pip show tensorflow
should give you, dependant on your version of pip the location of tensorflow on your machine.
Usually its /usr/lib/pythonX.X/site-packages where X.X can be substituted with your version of python/pip. The same should work for Windows machines.
You can then uninstall tensorflow bydeleting the folder tensforflow. You most likely will require sudo priveliges.
After you are done, there should be no traces of tensorflow on your machine.
In case you created virtual environment then activate it.
.\venv\Scripts\activate
notice (venv) before the command prompt.
now...
pip uninstall tensorflow
this worked for me!
Mine froze while uninstalling (!pip uninstall tensorflow). It was because the cmd tried to prompt whether to untinue "(Y/n) ?". The solution was to type "pip uninstall tensorflow" directly in the cmd and not in the notebook
If the previous answers did not work, try:
python -m pip uninstall tensorflow
directly in Command Prompt (for windows) instead of running the code in jupyter or VS.
if you had installed tensorflow-gpu previously, you should edit above code same as below in the command prompt:
python -m pip uninstall tensorflow-gpu

How to prevent pip from replacing numpy+mkl with just numpy when installing packages that require numpy?

When I pip install (or pip install --upgrade) packages that require numpy, they have a tendency to uninstall my existing numpy+mkl (which has a high enough version to satisfy the numpy version requirement). Afterwards, they install numpy without +mkl, which causes problems for other packages that do require MKL. An example for which this happens is gym (which has 'numpy>=1.10.4' in its install_requires in setup.py).
I understand that this is related to the +mkl suffix that probably somehow messes with the versions, and understand I can fix it afterwards by downloading and installing numpy+mkl from https://www.lfd.uci.edu/~gohlke/pythonlibs/, but it gets annoying to manually do this every time over again when upgrading a package like gym to a new version. Is there any way to prevent numpy+mkl from getting uninstalled during the pip install --upgrade?
For me, this is happening on Windows 10, Python 3.6. I did not yet check if the same happens on Linux, but would be interested in an answer for that too if it's different there.
My currently installed version of numpy+mkl (which often gets automatically uninstalled) is 1.13.3+mkl.
Using --upgrade-strategy, as suggested by cgohlke in a comment, addresses this problem. So, taking the example where we want to install gym from scratch without it replacing our existing numpy+mkl installation with regular numpy, the full command to run is:
pip install --upgrade-strategy only-if-needed gym
Or, if we just want to upgrade an existing installation, we also add --upgrade
pip install --upgrade --upgrade-strategy only-if-needed gym
I have found that some packages force pip to reinstall numpy. The safest (and only) way to ensure that numpy is installed with mkl (from conda) is to uninstall using conda and pip and then reinstall using conda:
conda uninstall numpy
pip uninstall nump
conda install numpy

Categories