Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

conda and pip not working at all

I am on OS X 10.11.2, Anaconda Python 2.7.10.

I was installing some dependencies, and suddenly, my conda command started not working at all. Many people suggest conda install python=2.7.10 but when I try that (or any command, even just conda) I get:

Traceback (most recent call last): File "/Users/Can/anaconda/bin/conda", line 5, in sys.exit(main()) File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 106, in main from conda.cli import conda_argparse File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 16, in from conda.cli.find_commands import find_commands, find_executable File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/find_commands.py", line 9, in from conda.utils import memoized File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/utils.py", line 10, in import tempfile File "/Users/Can/anaconda/lib/python2.7/tempfile.py", line 32, in import io as _io File "/Users/Can/anaconda/lib/python2.7/io.py", line 51, in import _io ImportError: dlopen(/Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder Referenced from: /Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so Expected in: dynamic lookup

How can I repair conda, without using conda itself (as I can't)?

UPDATE: I've completely uninstalled and reinstalled Anaconda. It still gives the same error. I've tried pip and it also fails with the same error. I verify it's Anaconda's pip as which pip returns /Users/Can/anaconda2/bin/pip. Why is Anaconda broken?

like image 852
Can Poyrazoğlu Avatar asked Jan 04 '16 10:01

Can Poyrazoğlu


1 Answers

I had the same issue, it is successfully fixed by just replacing the _io.so file.

sudo find / -name _io.so

copy the path of the _io.so file which DOES NOT belong to python-2.7.11. For example, copy the path of _io.so which is under python-2.7.5: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so

Replace the '/Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so' file with the _io.so that you just found.

cp /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so /Users/Can/anaconda/lib/python2.7/lib-dynload/

Then it will work.

like image 107
Yanan Avatar answered Oct 13 '22 12:10

Yanan