Conda and Anaconda running different Python Installs? - python

Using conda to update conda, and then anaconda, seems to be working on two different installs of python. And therefore seem to work against one another. For example:
My-MacBook-Pro:~ me$ conda update conda
Error: unknown host: http://repo.continuum.io/pkgs/pro/osx-64/
Package plan for installation in environment /Users/myname/anaconda:
The following packages will be UN-linked:
package | build
---------------------------|-----------------
python-2.7.5 | 3
readline-6.2 | 1
The following packages will be linked:
package | build
---------------------------|-----------------
python-2.7.6 | 1 hard-link
readline-6.2 | 2 hard-link
Proceed ([y]/n)? y
Unlinking packages ...
[ COMPLETE ] |##################################################| 100%
Linking packages ...
[ COMPLETE ] |##################################################| 100%
My-MacBook-Pro:~ me$ conda update anaconda
Package plan for installation in environment /Users/myname/anaconda:
The following packages will be UN-linked:
package | build
---------------------------|-----------------
python-2.7.6 | 1
readline-6.2 | 2
The following packages will be linked:
package | build
---------------------------|-----------------
python-2.7.5 | 3 hard-link
readline-6.2 | 1 hard-link
Proceed ([y]/n)? y
Unlinking packages ...
[ COMPLETE ] |##################################################| 100%
Linking packages ...
[ COMPLETE ] |##################################################| 100%
My-MacBook-Pro:~ me$ conda update conda
Package plan for installation in environment /Users/myname/anaconda:
The following packages will be UN-linked:
package | build
---------------------------|-----------------
python-2.7.5 | 3
readline-6.2 | 1
The following packages will be linked:
package | build
---------------------------|-----------------
python-2.7.6 | 1 hard-link
readline-6.2 | 2 hard-link
Proceed ([y]/n)?
Recommendations for how to deal with this, it's not a huge issue at the moment functionality wise.

This happens because the version of Python in the latest version of Anaconda is 2.7.5. When a new version of Anaconda is released (which should happen this week), this problem will go away.
The anaconda package is a stable set of versions packages of packages that have been tested against one another. Hence, installing or updating anaconda may downgrade Python, because that is the version that is in Anaconda.

Related

Anaconda cannot modify the Python version

want to create a python 3.6 environment. Below are the commands I executed and the output, but as you can see, the last python version shows 2.7. Why is this? I re-exit the terminal, re-enter, still 2.7 version
(base) :~/workspace/gem5$ conda create -n rcnn python=3.6
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/cuiyujie/anaconda3/envs/rcnn
added / updated specs:
- python=3.6
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2016.2.28 | py36_0 214 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
pip-9.0.1 | py36_1 1.7 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
python-3.6.2 | 0 31.5 MB http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
setuptools-36.4.0 | py36_1 534 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
wheel-0.29.0 | py36_0 129 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
wincertstore-0.2 | py36_0 14 KB http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
------------------------------------------------------------
Total: 34.1 MB
The following NEW packages will be INSTALLED:
certifi anaconda/pkgs/free/win-64::certifi-2016.2.28-py36_0
pip anaconda/pkgs/free/win-64::pip-9.0.1-py36_1
python anaconda/pkgs/free/win-64::python-3.6.2-0
setuptools anaconda/pkgs/free/win-64::setuptools-36.4.0-py36_1
vc anaconda/pkgs/free/win-64::vc-14-0
vs2015_runtime anaconda/pkgs/free/win-64::vs2015_runtime-14.0.25420-0
wheel anaconda/pkgs/free/win-64::wheel-0.29.0-py36_0
wincertstore anaconda/pkgs/free/win-64::wincertstore-0.2-py36_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
python-3.6.2 | 31.5 MB | ################################################################################################################################ | 100%
wheel-0.29.0 | 129 KB | ################################################################################################################################ | 100%
setuptools-36.4.0 | 534 KB | ################################################################################################################################ | 100%
certifi-2016.2.28 | 214 KB | ################################################################################################################################ | 100%
wincertstore-0.2 | 14 KB | ################################################################################################################################ | 100%
pip-9.0.1 | 1.7 MB | ################################################################################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate rcnn
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) :~/workspace/gem5$ conda activate rcnn
(rcnn) :~/workspace/gem5$ python --version
Python 2.7.12
(rcnn) :~/workspace/gem5$
At the end of my .bashrc is export PATH="/home/cuiyujie/anaconda3/bin:$PATH". This shows that the path of my anaconda is put to the front, but when I use echo $PATH, the output is /home/cuiyujie/bin:/home/cuiyujie/.local/bin:/home/cuiyujie/anaconda3/bin:/home/cuiyujie /anaconda3/condabin:/usr/local/sbin:. Why did Anaconda run behind again?
When I use the export PATH="/home/cuiyujie/anaconda3/bin:$PATH command directly in the terminal.
echo $PATH is
/home/cuiyujie/anaconda3/bin:/home/cuiyujie/bin:/home/cuiyujie/.local/bin:/home/cuiyujie/anaconda3/bin:/home/cuiyujie/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/arm_4.4.3/bin
I tried the conda command again and checked the python version
(base) :~$ conda activate rcnn
(rcnn) :~$ python --version
Python 3.8.5
The version is 3.85, which is the same as the built-in version, not the 3.6 I created
(rcnn) :~$ which python
/home/cuiyujie/anaconda3/bin/python
(rcnn) :~$ echo $PATH
/home/cuiyujie/anaconda3/envs/rcnn/bin:/home/cuiyujie/bin:/home/cuiyujie/.local/bin:/home/cuiyujie/anaconda3/bin:/home/cuiyujie/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/arm_4.4.3/bin
I am using the linux version. I am sure I downloaded the Linux version.Anaconda3-2020.07-Linux-x86_64.sh But I entered the package of the environment I created, which contained .ddl and exe files, which was so strange. I uninstalled and reinstalled it several times. But Anaconda is the linux version, and the created environment is the window version.
Did you alias python=/path/to/python2.7 ?
Or maybe you can try:
conda deactivate
conda activate rcnn
Check which python you are using by:
which python
Anaconda Navigator is for Setting up an environment or installing/updating packages in a specific environment of your choice. If you are having a new environment set up say, previously u have an existing 3.5 and now you are setting up 3.7 then, you will have to install the spyder kernel. Dont worry, when you start the system will flag this and you just have to install that through Navigator.
[Spyder > Tools > Preferences][1]
[1]: https://i.stack.imgur.com/qoSDV.png
Here in Spyder, your editor you typically would have the default python interpretor, change it to the environment of your choice.
[Prefernce > Set new python exe from specific environment][2]
[2]: https://i.stack.imgur.com/XiQro.png
So when you click on the Use the following interpretor, and open the file , you need to browse to the anaconda environment, select the respective version.
[Select Python Version][3]
[3]: https://i.stack.imgur.com/u4vQm.png
Now apply and say ok.
You need to restart your spyder for this to take effect for the first time.
It's very simple using Anaconda Navigator. Just choose your right environment and select Python version from the list. Check the screenshots for more clarity.

Why is conda installing packages that differ only by a hyphen or underscore?

I am creating a new conda environment, and it is not clear to me why there are several required package dependencies that have the same name, but differ by a hyphen/underscore character. Here is an example snippet below from the package plan output. Thanks very much for any type of clarification. The only information I could find was that the noarch versions are platform independent, but it is still unclear then why there would be multiple versions required (and why the naming differs).
The following packages will be downloaded:
package | build
---------------------------|-----------------
...
...
importlib-metadata-1.6.0 | py36_0 50 KB
importlib_metadata-1.6.0 | 0 11 KB
...
...
prompt-toolkit-3.0.5 | py_0 245 KB
prompt_toolkit-3.0.5 | 0 11 KB
...
The following NEW packages will be INSTALLED:
...
...
importlib-metadata pkgs/main/linux-64::importlib-metadata-1.6.0-py36_0
importlib_metadata pkgs/main/noarch::importlib_metadata-1.6.0-0
...
...
prompt-toolkit pkgs/main/noarch::prompt-toolkit-3.0.5-py_0
prompt_toolkit pkgs/main/noarch::prompt_toolkit-3.0.5-0

RemoveError: 'requests' is a dependency of conda and cannot be removed from conda's operating environment

Having trouble installing a third party library and I have not seen this error before using Windows 10 with Anaconda installed:
C:\Users\XYZ>conda env create -f python3.6-environment-windows.yml
Collecting package metadata: done
Solving environment: done
Downloading and Extracting Packages
certifi-2018.1.18 | 144 KB | ############################################################################ | 100%
mkl-2018.0.1 | 155.2 MB | ############################################################################ | 100%
pytz-2018.9 | 229 KB | ############################################################################ | 100%
icc_rt-2019.0.0 | 9.4 MB | ############################################################################ | 100%
icu-58.2 | 21.8 MB | ############################################################################ | 100%
pip-9.0.1 | 1.7 MB | ############################################################################ | 100%
xz-5.2.3 | 348 KB | ############################################################################ | 100%
sip-4.18.1 | 269 KB | ############################################################################ | 100%
libpng-1.6.36 | 1.3 MB | ############################################################################ | 100%
vc-14 | 985 B | ############################################################################ | 100%
numpy-1.14.0 | 3.7 MB | ############################################################################ | 100%
python-3.6.4 | 17.6 MB | ############################################################################ | 100%
jpeg-9c | 314 KB | ############################################################################ | 100%
wheel-0.30.0 | 85 KB | ############################################################################ | 100%
wincertstore-0.2 | 13 KB | ############################################################################ | 100%
freetype-2.9.1 | 475 KB | ############################################################################ | 100%
scipy-1.0.0 | 13.0 MB | ############################################################################ | 100%
pyparsing-2.3.1 | 54 KB | ############################################################################ | 100%
kiwisolver-1.0.1 | 60 KB | ############################################################################ | 100%
qt-5.6.2 | 55.6 MB | ############################################################################ | 100%
python-dateutil-2.7. | 218 KB | ############################################################################ | 100%
vs2015_runtime-14.0. | 1.9 MB | ############################################################################ | 100%
ca-certificates-2017 | 489 KB | ############################################################################ | 100%
tk-8.6.7 | 3.5 MB | ############################################################################ | 100%
setuptools-38.4.0 | 540 KB | ############################################################################ | 100%
matplotlib-2.2.2 | 6.5 MB | ############################################################################ | 100%
six-1.12.0 | 21 KB | ############################################################################ | 100%
openssl-1.0.2n | 5.4 MB | ############################################################################ | 100%
pyqt-5.6.0 | 4.5 MB | ############################################################################ | 100%
zlib-1.2.11 | 236 KB | ############################################################################ | 100%
tornado-5.1.1 | 665 KB | ############################################################################ | 100%
sqlite-3.22.0 | 907 KB | ############################################################################ | 100%
cycler-0.10.0 | 8 KB | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: failed
RemoveError: 'requests' is a dependency of conda and cannot be removed from
conda's operating environment.
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.
In reference to the instructions here - https://enigma.co/catalyst/install.html#installing-with-conda
I had the same problem on Mac Mojave, and in my case run conda update --force conda first worked for me.
running conda update conda before solved the problem for me
conda update --force conda
will solve : Verifying transaction: failed Remove Error: 'request' is a dependency of conda and cannot be removed from conda is operating environment.
This worked for me on Linux:
Uninstall the package via pip:
pip uninstall setuptools
Reinstall using the following command:
conda install -c anaconda setuptools
Consider also that system packages (python3-setuptools, python-setuptools in Ubuntu) might need to be removed.
conda update --force conda
this worked for me in win64 when I
conda install -c https://conda.anaconda.org/sdvillal openslide-python
Silly point to make here but I've been caught by this before: you may not be in the environment you think you are. Just before killing off any package run a quick check to see:
conda env list
Performing ops on the base environment can cause issues, so you may want to create or change environment.
I had the same problem, which was due to a bad installation of a package (OpenEXR in my case).
Try to verify your package with conda list yourPackage.
If you find which one it is, prefer installing it with pre-built packages here : https://www.lfd.uci.edu/~gohlke/pythonlibs/.
A stack-overflow thread that helped me : Python 2.7, PIP: "Failed building wheel for ..."
EDIT :
Two friends had the same error, one solved it by installing/executing with admin rights.
The other one succeeded by creating a new virtual environnement for python.
I ran into the same problem, on macos, after removing all R packages installed by anaconda. Unfortunately, the only solution I found is to reinstall anaconda. Alternatively, you could download miniconda shell script installer, run it with -U option and point the installer at your conda directory. This fixed the issue for me while maintaining settings such as channel priority. However, many of previously installed packages were not importable (Python couldn't find them) and i ended up re-installing all of them.
I had the same problem. Try to use the command prompt to install wheel file if you get an error something like this(as shown in picture) then you must install that wheel file:
Extra(how to install wheel file from command prompt):
download wheel file as per the system specifications: -search required file here https://www.lfd.uci.edu/~gohlke/pythonlibs/ -e.g.
bsddb3 -click bsddb3 and search required file
open command prompt on your system
change the location on the command prompt to: where you have downloaded wheel file e.g C:\Users\Name\Downloads
go to the location, where you have installed python>>go to script>> copy the path (e.g C:\Program Files (x86)\Python36-32\Scripts)
write the command, to install wheel file using pip install (e.g. C:\Program Files (x86)\Python36-32\Scripts\pip install
copy_name_of_the_wheel_file)
run the command
try conda env create --force -f python3.6-environment-windows.yml
I'm not sure exactly where to place it but I use the --force whenever I run into issues like this like conda update --force conda or conda install --force ...
use it as last solution since it force conda to perform the command and you might run into some issues later on
I had solved the problem
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.
As the following way:
pip uninstall setuptools
conda update conda
conda update setuptools
and then check tools
I haven't met any mistakes yet, but help me correct my way , if something wrong, please
For me, deactivating the current conda environment solves the problem, i.e. run conda deactivate before upgrading.
I had to do the following steps to get it to work for me
conda update --force conda
This will run and update conda then run the following command
conda update conda
At each stage update all packages. After that, everything should work fine.

Installing PyTorch under conda fails with permissions error and Rolling back transaction

I'd like to use PyTorch in a Python program. The instructions for installing it require conda. After installing Conda I ran:
>conda install -c pytorch pytorch (as instructed on the PyTorch [page][1])
It looked promising -- until the end.
Solving environment: done
## Package Plan ##
environment location: C:\ProgramData\Miniconda3
added / updated specs:
- pytorch
The following packages will be downloaded:
package | build
---------------------------|-----------------
icc_rt-2017.0.4 | h97af966_0 8.0 MB
vs2015_runtime-15.5.2 | 3 2.2 MB
pytorch-0.4.0 |py36_cuda80_cudnn7he774522_1 529.2 MB pytorch
mkl-2018.0.3 | 1 178.1 MB
numpy-1.14.5 | py36h9fa60d3_4 35 KB
intel-openmp-2018.0.3 | 0 1.7 MB
numpy-base-1.14.5 | py36h5c71026_4 3.8 MB
vc-14.1 | h0510ff6_3 5 KB
blas-1.0 | mkl 6 KB
conda-4.5.8 | py36_0 1.0 MB
mkl_fft-1.0.2 | py36hb217b18_0 113 KB
mkl_random-1.0.1 | py36h77b88f5_1 268 KB
------------------------------------------------------------
Total: 724.4 MB
The following NEW packages will be INSTALLED:
blas: 1.0-mkl
icc_rt: 2017.0.4-h97af966_0
intel-openmp: 2018.0.3-0
mkl: 2018.0.3-1
mkl_fft: 1.0.2-py36hb217b18_0
mkl_random: 1.0.1-py36h77b88f5_1
numpy: 1.14.5-py36h9fa60d3_4
numpy-base: 1.14.5-py36h5c71026_4
pytorch: 0.4.0-py36_cuda80_cudnn7he774522_1 pytorch
The following packages will be UPDATED:
conda: 4.5.4-py36_0 --> 4.5.8-py36_0
vc: 14-h0510ff6_3 --> 14.1-h0510ff6_3
vs2015_runtime: 14.0.25123-3 --> 15.5.2-3
Proceed ([y]/n)? y
Downloading and Extracting Packages
icc_rt-2017.0.4 | 8.0 MB | ############################################################################## | 100%
vs2015_runtime-15.5. | 2.2 MB | ############################################################################## | 100%
pytorch-0.4.0 | 529.2 MB | ############################################################################# | 100%
mkl-2018.0.3 | 178.1 MB | ############################################################################# | 100%
numpy-1.14.5 | 35 KB | ############################################################################## | 100%
intel-openmp-2018.0. | 1.7 MB | ############################################################################## | 100%
numpy-base-1.14.5 | 3.8 MB | ############################################################################## | 100%
vc-14.1 | 5 KB | ############################################################################## | 100%
blas-1.0 | 6 KB | ############################################################################## | 100%
conda-4.5.8 | 1.0 MB | ############################################################################## | 100%
mkl_fft-1.0.2 | 113 KB | ############################################################################## | 100%
mkl_random-1.0.1 | 268 KB | ############################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
But then this.
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py36_0'.
PermissionError(13, 'Access is denied')
Attempting to roll back.
Rolling back transaction: done
PermissionError(13, 'Access is denied')
Apparently it was at least partly installed because PyCharm was able to see it. But when I asked PyCharm to install it in an environment, I got this error.
RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).
Please follow the instructions at http://pytorch.org/ to install with miniconda instead.
It suggests an alternative way to install PyTorch. So I tried that.
>conda install pytorch torchvision -c pytorch
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- torchvision
Current channels:
- https://conda.anaconda.org/pytorch/win-64
- https://conda.anaconda.org/pytorch/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/free/win-64
- https://repo.anaconda.com/pkgs/free/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/pro/win-64
- https://repo.anaconda.com/pkgs/pro/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
But when I do that and search for PyTorch, I eventually find myself back at the original instructions.
When I search for Torchvision, no Windows versions are listed.
Try the following steps in Windows:
Create a virtual environment using the command :
conda create -n py_env python=3.5
source activate py_env
conda install pytorch-cpu -c pytorch
pip install torchvision
Note: You can use any name instead of py_env
Thanks
What is your platform?
For your first installation method, the error message says that you don't have the permission. I encountered that error before on a Linux system. The reason was that Anaconda was installed by another user. I configured the path to point python to that installation so that I could run python without installing my own copy of Anaconda. However, it didn't permit me installing new packages and I got the same error message.
Solution: I installed my own copy of Anaconda and everything worked.
just run:
pip install torch torchvision
An alternative way to install PyTorch is the following steps:
conda create -n pytorch_env python=3
source activate pytorch_env
conda install pytorch-cpu torchvision -c pytorch
Go to python shell and import using the command
import torch
Open the terminal in administrative mode and if you are in linux try
sudo pip install "your package name"

Installing OpenCV with Conda

Installing packages to start running some code is perhaps the hardest part of my job.
Anways, I tried installing opencv for use in anaconda python 3.6 environment. And I get the error:
conda install -c conda-forge opencv
Fetching package metadata ...........
Solving package specifications: ..........
Package plan for installation in environment C:\Program Files\Anaconda3\envs\py36:
The following packages will be downloaded:
package | build
---------------------------|-----------------
libwebp-0.5.2 | vc14_7 1.1 MB conda-forge
opencv-3.2.0 | np112py36_204 92.0 MB conda-forge
------------------------------------------------------------
Total: 93.1 MB
The following NEW packages will be INSTALLED:
libwebp: 0.5.2-vc14_7 conda-forge [vc14]
opencv: 3.2.0-np112py36_204 conda-forge
Proceed ([y]/n)? y
Fetching packages ...
libwebp-0.5.2- 100% |###############################| Time: 0:00:05 213.41 kB/s
opencv-3.2.0-n 100% |###############################| Time: 0:00:48 1.97 MB/s
Extracting packages ...
[ COMPLETE ]|##################################################| 100%
Linking packages ...
PaddingError: Placeholder of length '34' too short in package conda-forge::opencv-3.2.0-np112py36_204.
The package must be rebuilt with conda-build > 2.0.
I am on a Windows System. I do not understand the error and searching isn't helping.
Any comments or suggestions to resolve the error are welcome.
For the record, OpenCV installs fine with pip.
Tested on Windows 10 with Miniconda and Python 3.6:
> pip search opencv
...
opencv-python
...
> pip install opencv-python
Tells me Requirement already satisfied.
To make sure it was correctly installed, run:
> python
>>> import cv2
>>>
Go to the root conda environment.
And do conda update conda.
Then just import cv2 and use it.

Categories

Resources