Anaconda: "conda update conda" issue - python

Having difficulties after installing Anaconda 1.9.2 Windows x86-64 on Windows 7 (64-bit).
I already had an install of Python 2.7, so I installed for All Users. I selected "Add Anaconda to my PATH environment variable", but I did not select "Register Anaconda as my default Python 2.7".
Install was successful , but upon attempting to run (as Administrator) "conda update conda" and "conda update ipython" I'm getting the following error:
Traceback (most recent call last):
File "C:\Anaconda\Scripts\conda-script.py", line 2 in
from conda.cli import main
ImportError: No module named conda.cli.
I did a system search and I can't find a single instance of conda.cli on my machine, is there some way the install would've missed this file, or is there something else I should have installed? I've seen this question involving 64-bit Linux Anaconda, but not Windows.

Please check whether you have this folder in your system: C:\Anaconda\Lib\site-packages\conda\cli'.
Also please try to check your python path and attach the logs:
(TEST) C:\anaconda3\Scripts>python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import os
>>> print(os.sys.path)
['', 'C:\\anaconda3\\envs\\TEST\\python36.zip', 'C:\\anaconda3\\envs\\TEST\\DLLs', 'C:\\anaconda3\\envs\\TEST\\lib', 'C:\\anaconda3\\envs\\TEST', 'C:\\anaconda3\\envs\\TEST\\lib\\site-packages']

Related

Anaconda activation fails

Essentially what the title says. Here is a snippet from cmd:
C:\Users\Marc>conda activate quantum
(quantum) C:\Users\Marc>py
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Ana
conda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>> from qiskit import QuantumCircuit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'QuantumCircuit' from 'qiskit' (unknown location
)
>>>
This is despite the fact that I ran the command to activate an environment (conda activate quantum). The base environment does work, but I want to activate another environment.
For those curious, Anaconda navigator and pip freeze both show that qiskit is installed in this env.
I realized my mistake. I should've typed python to start the interpreter.

Module detected by iPython but not Python in same virtual environment

I'm running a script from a Python 3.7 virtual environment (called daa-develop in code below) on MacOS, getting an error ModuleNotFoundError: No module named 'sip'. When then installing sip after, I get 'requirements already satisfied'.
The peculiar behaviour is that when I use IPython in the terminal, it's able to import sip, but not when I use Python in the terminal.
As below:
(daa-develop) :daa-develop $ python
Python 3.7.7 (default, Mar 26 2020, 10:32:53)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
import sip
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sip'
exit()
(daa-develop) :daa-develop $ ipython
Python 3.7.7 (default, Mar 26 2020, 10:32:53)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import sip
In [2]:
Any ideas?
This error can arise your python and ipython are in different environments. It could have been that you installed sip in the same environment as ipython, and so ipython was able to find it. Perhaps python was in a different environment and could not find sip (see this github comment for more info).
Even if that is not the issue, miniconda makes it very easy to start fresh with new environments. I would suggest creating a new environment and re-installing ipython and sip.
conda create --name testing python=3.7 ipython sip
conda activate testing
python -c "import sip"
ipython -c "import sip"

Anaconda errors in Terminal and VS Code

Running into an issue I'm not sure how to resolve:
Installed VS Code, and used Homebrew to install Python 3.7, then installed Anaconda - was given an option to install it to my user home, and chose that option.
When I start up Terminal or VS Code though, I'm hitting this error - what have I likely missed?
Last login: Sat Dec 22 22:04:18 on ttys000
Traceback (most recent call last):
File "/Users/<myusername>/anaconda2/bin/conda", line 7, in <module>
from conda.cli import main
ImportError: No module named conda.cli
(Mac running Sierra)
I've attempted the following:
export PYTHONPATH="$HOME/.miniconda2/lib/python2.7:$HOME/.miniconda2/lib/python2.7/site-packages:$PYTHONPATH"
and the paths do appear to include Anaconda's paths. Python indicates Anaconda is present as well:
Python 3.7.1 (default, Dec 14 2018, 13:28:58)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
I'm sure I've missed a detail somewhere, but not sure what.
Likely this was a brute-force solution, but running anaconda-clean and then uninstalling anaconda2 and anaconda3, and finally reinstalling anaconda3 appears to have resolved this, since I don't actually need anaconda on Python2.7. I imagine the correct solution if I needed them both would be to set up additional environments to handle this.

Unable to import pytables with intelpython

wonder if anyone has tried IntelPython with anaconda. i created an environment as in url link
Intel Python
however, when i try to import pytables, i get: -
(intelpython) dc#dcpctw:/opt/anaconda3/bin$ python
Python 3.5.3 |Intel Corporation| (default, Apr 27 2017, 18:08:47)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
>>> import tables
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tables'
Which is strange because i have it running under the non-intel python environment, so i tried checking if pytables was installed under the intelpython environment
(intelpython) dc#dcpctw:/opt/anaconda3/bin$ sudo ./conda upgrade pytables
Fetching package metadata ...........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /opt/anaconda3:
#
pytables 3.3.0 np112py35_intel_2 [intel] intel
(intelpython) dc#dcpctw:/opt/anaconda3/bin$
So its installed in the environment and should work, any help? thanks
You are running the python executable from /opt/anaconda/bin but you have an activated environment of (intelpython). Change to a different directory, e.g., ~, make sure the first python on your PATH is /opt/anaconda3/envs/intelpython/bin/python, and try the import again.

After miniconda 3.3.0 (anaconda) installation, I get no module named conda.cli error

I installed latest version of miniconda on a linux 64-bit filesystem that does not allow hard links (openAFS).
These are installation steps:
run installer until it fails on hard link errors
then modify install.py specified in $CONDA_INSTALL adding two line at the top of _link function
if linktype==HARD_LINK:
linktype=SOFT_LINK
now execute $PYTHON $CONDA_INSTALL --prefix=$PREFIX --pkgs-dir=$PREFIX/pkgs --link-all and everything works
The problem is that even if python is correctly installed,
> miniconda/bin/python
Python 2.7.6 |Continuum Analytics, Inc.| (default, Jan 17 2014, 10:13:17)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
I cannot run conda:
> miniconda/bin/conda
Traceback (most recent call last):
File "miniconda/bin/conda", line 3, in <module>
from conda.cli import main
ImportError: No module named conda.cli
I tried to set $PATH and/or $PYTHONPATH and/or $LD_LIBRARY_PATH but without success.
Is there a way to solve this issue? Is there a way to force soft link in place of hard link during installation?
Thanks,
Angelo

Categories

Resources