I can successfully run a python script that uses
from sklearn.cluster import DBSCAN
from the 64 bit cygwin terminal prompt which uses a 64bit build of python 2.7.
When I run the same from both 64 bit and 32 bit pycharm with -vv
interpreter options, I get (the first 2 lines are the verbose output):
import numpy.linalg.linalg # precompiled from /usr/lib/python2.7/site-packages/numpy/linalg/linalg.pyc
dlopen("/usr/lib/python2.7/site-packages/numpy/linalg/lapack_lite.dll", 2);
Traceback (most recent call last):
File "C:/Users/mack0242/Dropbox/PhD/scripts/cluster.py", line 5, in <module>
from sklearn.cluster import DBSCAN
File "/usr/lib/python2.7/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "/usr/lib/python2.7/site-packages/sklearn/base.py", line 9, in <module>
import numpy as np
File "/usr/lib/python2.7/site-packages/numpy/__init__.py", line 170, in <module>
from . import add_newdocs
File "/usr/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/site-packages/numpy/lib/__init__.py", line 18, in <module>
from .polynomial import *
File "/usr/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 19, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "/usr/lib/python2.7/site-packages/numpy/linalg/__init__.py", line 51, in <module>
from .linalg import *
File "/usr/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 29, in <module>
from numpy.linalg import lapack_lite, _umath_linalg
ImportError: No such file or directory
I have double checked and the file:
/usr/lib/python2.7/site-packages/numpy/linalg/lapack_lite.dll
exists and is 64 bits. I have successfully installed numpy,scipy and sklearn from pip on the cygwin terminal.
Additionally, PyCharm says there are no modules named sklearn
, matplotlib
and numpy
.
When I had a similar problem (couldn't import numpy in Pycharm but on cygwin console), it turned out that cygwin was using a different interpreter as PyCharm.
In PyCharm I had configured the interpreter from
C:\Program Files\cygwin\usr\bin\python
. In contrast, cygwin was using/bin/python
. In PyCharm clickFile > Settings > Project: yourProjectName > Project Interpreter
, click on"Add local"
and find the interpreter used by cygwin (in my caseC:\Program Files\cygwin\bin\python
).Then open the Python Console in PyCharm via
View > Tools Windows > Python Console
and try your import statement.