Pip does not install tensorflow in the conda env - windows

I got something weird on Windows (I don't use it since 2012). I created a conda env long time ago with tensorflow 2.2.0. Now, I want to update tensorflow to the latest. As in Linux, I activate the env and I run pip install tensorflow. The problem that pip installs it in the global package, not in the env.
Here are some logs:
here when I try to uninstall tensorflow 2.2.0. It does not detect it and it detects 2.3.1 which is installed in global package
I think the problem is coming from pip path:
I checked and I see that pip install everything here c:\programdata\anaconda3\lib\site-packages
I tried to create a new environment but I got the same results!!
Anyone got already this problem?

Related

Upgrading TensorFlow Using Conda

Every time I try to upgrade tensorflow with conda, it tells me everything is updated but it hasn't done anything.
It looks like my conda is messed up because the latest TensorFlow it's showing is 2.6.0. So far the only solution I've found is a full delete and reinstall of conda.
What's wrong with conda/tensorflow?
I've used
pip install tensorflow
conda upgrade tensorflow
conda install -c conda-forge tensorflow

pip trying to install using old version of python

so I just uninstalled a wrong version of python 3.8 and downloaded python 3.7.4
Now I'm trying to install packages using the command pip install X and get the following error.
C:\Users\User>pip install cv2
Fatal error in launcher: Unable to create process using '"c:\users\user\appdata\local\programs\python\python38-32\python.exe" "C:\Users\User\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe" install cv2': The system cannot find the file specified.
clearly it is still trying to use the old version of python 3.8 even though I have uninstalled it and reinstalled pip several times.
Any idea on why its trying to look for this old path? and how can I change the default path it is using?
(btw this is just a matter of convenience because as of the moment if I use the command python -m pip install X it does seem to work)
try command python -m pip install --upgrade pip
Delete and clear environment config and install again...

Installing packages in conda environments fails when conda attempts to uninstall a root package

I've installed Anaconda on linux, it's installed in user space under my home folder.
I've created an environment.
Within that environment I've run conda install anaconda to install all standard packages.
I'm trying to install tensorflow now, running:
pip install --upgrade tensorflow-gpu
This process attempts to upgrade the numpy package. But that step errors out because it's trying to uninstall the system numpy package in /usr/local/bin/f2py.
I thought this environment was all self-contained in user space. Any idea why it would attempt to uninstall a system package that was installed before Anaconda was installed?
You probably need to clear your PYTHONPATH environment variable, if its pointing at the system installation of Python.

Dependency issue with conda, pip and virtualenv

I am using conda(anaconda 2). Before installing anaconda, my Ubuntu16.04 already had pip installed. I recently installed virtualenv using pip install virtualenv. I did the following steps while trying to install coala in my virtual environment.
Create a new virtual environment using virtualenv venv
Activate environment using source activate path/to/activate
Clone the coala repository.
Run pip3 install -e . while inside the repository
After all this, I get the following error from coala:
There is a conflict in the version of a dependency you have installed and the requirements of coala. This may be resolved by creating a separate virtual environment for coala or running `pip install "yapf~=0.14.0"`. Be aware that the latter solution might break other python packages that depend on the currently installed version.
I am already in a virtualenv, so I tried installing yapf as per the command: pip install "yapf~=0.14.0". After that, when I check my pip list, it still showed yapf (0.15.2), To solve this, I did:
pip uninstall yapf
pip install "yapf~=0.14.0"
Now when I check my pip list, I get the desired results. BUT, the error is still there. It still shows the same dependency error. I am unable to understand what is happening? Which pip is installing what and where, what is conda doing behind the scenes, how is virtualenv behaving with conda, and the most important, why this error and how to resolve it?
first create a virtualenv pertaining to python3.x
template
virtualenv -p {location of python3 version } {name of virtualenv folder}
like this
virtualenv -p /usr/local/bin/python3 venv
then activate it
source venv/bin/activate
then run
pip install {library you want to use}
pip install "yapf~=0.14.0"
This should install yapf into the venv folder.
try that let us know.
Answering my own question, what I found out was that conda and virtualenv do not go hand in hand. condas has the ability to create it's own virtual environment, and if using condas, we must create a conda virtual environment(See this answer).
What I did was uninstalled conda and make a virtual environment using virtualenv. What I could have done as well is uninstall virtualenv and create condas environment and work in that.

Installing Python Package to Conda Env Without Using Conda

I have a fresh Anaconda environment in which I would like to install the latest release of mysql-connector-python (v2.1.3). I'm on a CentOS6 system. The problem is, the newest Conda-hosted package is 2.0.3 and because the connector is not currently hosted on PyPI, it cannot be installed via Pip. (Pip's --allow-external option has been deprecated.)
I know that I can easily install the package via yum install, but I believe that will install it outside of the Conda environment.
Is there any way, using yum or otherwise, to isolate this package solely to this particular Conda environment?
Turns out this is surprisingly simple. Just download the source for the Python package that is not available on PyPI and pip install at the source directory. Just remember to have the Conda environment you want to install to active and Pip will correctly isolate the install to env scope.
I was unaware of Pip's install from local options, so big thanks to the folks on the Anaconda mailing list for their help with this.

Resources