So i finally managed to get theano up and running on the GPU using this guide. (the test code runs fine, telling me it used the GPU, YAY!!)
I then wanted to try it out and followed this guide for training a CNN on digit recognition.
problem is: i get errors from the way lasagne calls theano (i guess there is a version mismatch here):
Using gpu device 0: GeForce GT 730M (CNMeM is disabled, cuDNN not available)
Traceback (most recent call last):
File "C:\Users\Soren Jensen\Desktop\CNN-test\CNNTest-one.py", line 7, in <module>
import lasagne
File "C:\Users\Soren Jensen\Anaconda3\lib\site-packages\lasagne\__init__.py", line 19, in <module>
from . import layers
File "C:\Users\Soren Jensen\Anaconda3\lib\site-packages\lasagne\layers\__init__.py", line 7, in <module>
from .pool import *
File "C:\Users\Soren Jensen\Anaconda3\lib\site-packages\lasagne\layers\pool.py", line 6, in <module>
from theano.tensor.signal import downsample
ImportError: cannot import name 'downsample'
Press any key to continue . . .
From reading about the error message, it seems that 'downsample' was changed, so why is my lasagne still calling it??
trying to update my lasagne version gives:
C:\WINDOWS\system32>pip3.5 install Lasagne==0.1
Collecting Lasagne==0.1
Requirement already satisfied: numpy in c:\users\soren jensen\anaconda3\lib\site-packages (from Lasagne==0.1)
and running the code sample
import theano
import os
print(theano.config.compiledir)
print("Theano version %s" % theano.__version__)
theano_dir = os.path.dirname(theano.__file__)
print("theano is installed in %s" % theano_dir)
reveals that python3.5 uses theano v 0.9
Using gpu device 0: GeForce GT 730M (CNMeM is disabled, cuDNN not available)
C:\theano_compiledir\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-3.5.2-64
Theano version 0.9.0.dev-e5bedc0de240eca42433c34c05fc00f4a5ef6cbe
theano is installed in C:\Users\Soren Jensen\Anaconda3\lib\site-packages\theano\theano
Press any key to continue . . .
Sorry for the long post, but i'm going a little crazy of this not working.. Maybe i am wrong in the version mismatch and the error is something else?
Try to reinstall Theano and Lasagne like this:
pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip
Because: "An even more recent version of Theano will often work as well, but at the time of writing, a simple pip install Theano will give you a version that is too old."
Read more: lasagne.readthedocs.io/en/latest/user/installation.html
Related
I have a laptop with Windows 10 Pro with Python 3.6.
This is my pip freeze on Windows:
numpy==1.19.5
absl-py==0.10.0
aiofiles==0.6.0
aiohttp==3.7.3
APScheduler==3.6.3
astor==0.8.1
async-generator==1.10
async-timeout==3.0.1
attrs==20.3.0
bidict==0.21.2
blis==0.7.4
boto3==1.16.50
botocore==1.19.50
bz2file==0.98
cached-property==1.5.2
cachetools==4.2.0
catalogue==1.0.0
certifi==2020.12.5
cffi==1.14.4
chardet==3.0.4
click==7.1.2
cloudpickle==1.6.0
colorama==0.4.4
colorclass==2.2.0
coloredlogs==10.0
colorhash==1.0.3
ConfigArgParse==1.2.3
contextvars==2.4
cryptography==3.3.1
cycler==0.10.0
cymem==2.0.5
dataclasses==0.8
decorator==4.4.2
dill==0.3.3
dnspython==1.16.0
docopt==0.6.2
dopamine-rl==3.0.1
fbmessenger==6.0.0
Flask==1.1.2
future==0.18.2
gast==0.2.2
gevent==1.5.0
gin-config==0.4.0
google-api-core==1.24.1
google-api-python-client==1.12.8
google-auth==1.24.0
google-auth-httplib2==0.0.4
google-pasta==0.2.0
googleapis-common-protos==1.52.0
greenlet==0.4.17
grpcio==1.34.0
gunicorn==20.0.4
gym==0.18.0
h11==0.8.1
h2==3.2.0
h5py==3.1.0
hpack==3.0.0
hstspreload==2020.12.22
httpcore==0.3.0
httplib2==0.18.1
httptools==0.1.1
httpx==0.9.3
humanfriendly==9.1
hyperframe==5.2.0
idna==2.10
idna-ssl==1.1.0
immutables==0.14
importlib-metadata==3.3.0
importlib-resources==4.1.1
itsdangerous==1.1.0
Jinja2==2.11.2
jmespath==0.10.0
jsonpickle==1.4.2
jsonschema==3.2.0
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
kfac==0.2.0
kiwisolver==1.3.1
Markdown==3.3.3
MarkupSafe==1.1.1
matplotlib==3.3.3
mattermostwrapper==2.2
mesh-tensorflow==0.1.18
mpmath==1.1.0
multidict==4.6.1
murmurhash==1.0.5
networkx==2.3
oauth2client==4.1.3
opencv-python==4.5.1.48
opt-einsum==3.3.0
packaging==19.2
pika==1.0.1
Pillow==7.2.0
plac==1.1.3
preshed==3.0.5
promise==2.3
prompt-toolkit==3.0.9
protobuf==3.14.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pydot==1.4.1
pyglet==1.5.0
PyJWT==1.7.1
pykwalify==1.7.0
pymongo==3.11.2
pyparsing==2.4.7
pypng==0.0.20
pyreadline==2.1
pyrsistent==0.17.3
python-crfsuite==0.9.7
python-dateutil==2.8.1
python-engineio==4.0.0
python-socketio==5.0.4
python-telegram-bot==11.1.0
pytz==2019.3
PyYAML==5.3.1
questionary==1.9.0
rasa==1.6.0
rasa-sdk==1.6.1
redis==3.3.11
requests==2.25.1
requests-async==0.5.0
requests-toolbelt==0.9.1
rfc3986==1.4.0
rocketchat-API==0.6.36
rsa==4.6
ruamel.yaml==0.15.100
s3transfer==0.3.3
sanic==19.9.0
Sanic-Cors==0.9.9.post1
sanic-jwt==1.5.0
Sanic-Plugins-Framework==0.9.4.post1
scikit-learn==0.20.4
scipy==1.5.4
six==1.15.0
sklearn-crfsuite==0.3.6
slackclient==1.3.2
sniffio==1.2.0
spacy==2.3.5
SQLAlchemy==1.3.22
srsly==1.0.5
sympy==1.7.1
tabulate==0.8.7
tensor2tensor==1.14.1
tensorboard==1.15.0
tensorflow==1.15.3
tensorflow-datasets==3.1.0
tensorflow-estimator==1.15.1
tensorflow-gan==2.0.0
tensorflow-hub==0.11.0
tensorflow-metadata==0.26.0
tensorflow-probability==0.7.0
termcolor==1.1.0
terminaltables==3.1.0
thinc==7.4.5
tqdm==4.55.1
twilio==6.50.1
typing-extensions==3.7.4.3
tzlocal==2.1
uritemplate==3.0.1
urllib3==1.26.2
wasabi==0.8.0
wcwidth==0.2.5
webexteamssdk==1.6
websocket-client==0.54.0
websockets==8.1
Werkzeug==1.0.1
wrapt==1.12.1
yarl==1.6.3
zipp==3.4.0
The project I'm working on uses Rasa 1.6.0 and with these requirements, everything runs as expected on Windows.
However, for a specific task, I need to be on Ubuntu and so I installed Ubuntu 18.04 on a VirtualBox 6.1 machine, installed python and pip and run pip install -r requirements.txt command to install the exact same requirements on that machine, inside a virtual environment.
After this, if I try to run rasa train on a shell or import tensorflow as tf on a python console, an error appears:
Illegal instruction (core dumped)
Any ideias on what the cause for this error could be ?
I saw some people saying it could be some incompatibility of tensorflow with the architecture of the processor being used, however in my case that should not be the problem since everything works on Windows (right ?).
I also tried to uninstall tensorflow and followed some online tutorials to Build from source but now, when I run rasa --version, tensorflow is no longer found:
$ rasa --version
Traceback (most recent call last):
File "/home/<USER>/Desktop/venv_rasa/bin/rasa", line 8, in <module>
sys.exit(main())
File "/home/<USER>/Desktop/venv_rasa/lib/python3.6/site-packages/rasa/__main__.py", line 69, in main
set_log_level(log_level)
File "/home/<USER>/Desktop/venv_rasa/lib/python3.6/site-packages/rasa/utils/common.py", line 68, in set_log_level
update_tensorflow_log_level()
File "/home/<USER>/Desktop/venv_rasa/lib/python3.6/site-packages/rasa/utils/common.py", line 108, in update_tensorflow_log_level
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
But, inside a Python console, I can import tensorflow but if I try so access anything, other errors are shown:
>>> import tensorflow as tf
>>> tf.__version__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute '__version__'
>>>
>>> mnist = tf.keras.datasets.mnist
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'keras'
Am I missing anything ?
Am I doing something wrong ?
Thanks in advance!
I saw some people saying it could be some incompatibility of tensorflow with the architecture of the processor being used, however in my case that should not be the problem since everything works on Windows (right ?).
I think this may in fact be your problem. When you're using VirtualBox, you're no longer in the same environment as on your windows machine, and you could be running into incompatibilities there that were not happening in your local windows environment.
The fact that the module you built from source is not found, is most likely because it isn't in your PYTHONPATH.
I would recommend using a virtual environment and following e.g. these instructions for installing tensorflow on Ubuntu, since that's what your VirtualBox is running: https://linuxize.com/post/how-to-install-tensorflow-on-ubuntu-18-04/
Here is what I get when I try to import it
>>> import numpy
Python(26024,0x11da32dc0) malloc: can't allocate region
:*** mach_vm_map(size=18446744071675105280, flags: 100) failed (error code=3)
Python(26024,0x11da32dc0) malloc: *** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/__init__.py", line 286, in <module>
raise RuntimeError(msg)
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
Here is additional info you might want to know.
I installed numpy.
eric#Erics-MacBook-Pro ~ % pip3 install numpy
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (1.19.2)
I recently erased oh-my-zsh but not completely so this always comes when I open terminal.
Last login: Tue Oct 6 17:57:22 on ttys002 /Users/eric/.zshrc:source:73: no such file or directory: /Users/eric/.oh-my-zsh/oh-my-zsh.sh
If there is something you need please let me know.
I have encountered the exact same issue while trying to import pandas (which requires numpy). Basically Python 3.9 isn't playing nicely with numpy on macOS for some very odd reason. Downgraded to Python 3.8 and everything works perfectly: https://www.python.org/downloads/release/python-386/.
I am trying to run a python package that requires pytorch-gpu. I have change the runtime type of my Colab notebook to GPU. When I run the command, I am facing the following error. Not sure if I am able to build pytorch on colab myself?
Traceback (most recent call last):
File "inference_unet.py", line 9, in <module>
import torchvision.transforms as transforms
File "/usr/local/lib/python3.6/dist-packages/torchvision/__init__.py", line 10, in <module>
from .extension import _HAS_OPS
File "/usr/local/lib/python3.6/dist-packages/torchvision/extension.py", line 58, in <module>
_check_cuda_version()
File "/usr/local/lib/python3.6/dist-packages/torchvision/extension.py", line 54, in _check_cuda_version
.format(t_major, t_minor, tv_major, tv_minor))
RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=10.2 and torchvision has CUDA Version=10.1. Please reinstall the torchvision that matches your PyTorch install.
Now you can directly use pytorch-gpu on google colab, no need of installation.
Just change your runtime to gpu, import torch and torchvision and you are done.
I have attached screenshot doing just the same.
Hope the answer will find helpful.
But in case you want to install different version of pytorch or any other package then you can install using pip, just add ! before your pip command and run the cell.
for example,
I'm trying to call a function from the cluster module, like so:
import sklearn
db = sklearn.cluster.DBSCAN()
and I get the following error:
AttributeError: 'module' object has no attribute 'cluster'
Tab-completing in IPython, I seem to have access to the base, clone, externals, re, setup_module, sys, and warning modules. Nothing else, though others (including cluster) are in the sklearn directory.
Following pbu's advice below and using
from sklearn import cluster
I get:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from sklearn import cluster
File "C:\Python34\lib\site-packages\sklearn\cluster\__init__.py", line 6, in <module>
from .spectral import spectral_clustering, SpectralClustering
File "C:\Python34\lib\site-packages\sklearn\cluster\spectral.py", line 13, in <module>
from ..utils import check_random_state, as_float_array
File "C:\Python34\lib\site-packages\sklearn\utils\__init__.py", line 16, in <module>
from .class_weight import compute_class_weight, compute_sample_weight
File "C:\Python34\lib\site-packages\sklearn\utils\class_weight.py", line 7, in <module>
from ..utils.fixes import in1d
File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
from .isolve import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
from .iterative import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
I'm using Python 3.4 on Windows, scikit-learn 0.16.1.
You probably don't use Numpy+MKL, but only Numpy.
I had the same problem and reinstalling Numpy with MKL
pip install --upgrade --force-reinstall "numpy‑1.16.3+mkl‑cp37‑cp37m‑win32.whl"
fixed it.
Note: update the file to the latest version, possibly 64bit - see the list of available Windows binaries
Problem was with scipy/numpy install. I'd been using the (normally excellent!) unofficial installers from http://www.lfd.uci.edu/~gohlke/pythonlibs/. Uninstall/re-install from there made no difference, but installing with the official installers (linked from http://www.scipy.org/install.html) did the trick.
I am using anaconda got the same error as the OP, when loading Orange, or PlotNine.
I can't recall when this start to happen.
Tracing the dependency of Anaconda3\Lib\site-packages\scipy\special\_ufuncs.cp36-win32.pyd, libifcoremd.dll and libmmd.dll are missing in DependencyWalk. Searching them in anaconda root directry, they are located in both ICC_RT and one version of MKL package.
Adding Anaconda3\pkgs\mkl-2017.0.3-0\Library\bin to PATH, seems to fix SciPy and NumPy related DLL load failure, the above package starts to work again.
I still don't know how to fix this properly. Apparently the downside is that the MKL package could be updated and versions may change so does the path. In this aspect Its equally inconvenient as adding a non-managed package.
Reinstalling ICC_RT fixed the issue for me, libmmd.dll and the related dlls are automatically copied into anaconda3/library/bin afterwards, which is automatically added into PATH by activate command. All previous numpy/scipy related cant load DLL errors are gone now.
From the error log, it shows that scipy module is the most recent module fails to import
File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
from .isolve import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
from .iterative import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
I have the same error that show the same log, the problem'd gone when I uninstall/install scipy:
pip uninstall scipy
pip install scipy
Place this line on top of the python file
from sklearn import cluster
That should do it :))
For me what fixed it were these commands:
pip uninstall sklearn
pip uninstall scikit-learn
pip uninstall scipy
pip install scipy
pip install scikit-learnhere
I had the same issue and solved it by installing/updating the mkl package:
conda install mkl
or
pip install mkl
Just for full information, this also downgraded the following packages:
The following packages will be UPDATED:
mkl: 2017.0.4-h6d528fc_0 defaults --> 2018.0.3-1 defaults
The following packages will be DOWNGRADED:
numpy: 1.11.3-py34_0 defaults --> 1.10.1-py34_0 defaults
pandas: 0.19.2-np111py34_1 defaults --> 0.18.1-np110py34_0 defaults
scikit-learn: 0.18.1-np111py34_1 defaults --> 0.17-np110py34_1 defaults
scipy: 0.19.1-np111py34_0 defaults --> 0.16.0-np110py34_0 defaults
I struggled trying to figure this one out; tried to download and install the (unofficial) Numpy+MKL library from the website (risky/tedious?).
Ultimately found success by:
Login to command prompt using admin rights; how to here: https://superuser.com/questions/968214/open-cmd-as-admin-with-windowsr-shortcut
Uninstall existing/tangled version of Scipy & Numpy
pip uninstall scipy
pip uninstall numpy
Fresh install Scipy & Numpy
pip install scipy
pip install numpy
Run Jupyter notebook; it worked for me.
The message ImportError: DLL load failed: The specified module could not be found
informs that there is failure to identify and source the required DLL(s) to use the scikit-learn library; a fresh install of scipy/numpy probably enables a better routing of DLL connections called from Jupyter notebook code(s).
download microsoft visual c++ distribution
link : https://www.microsoft.com/en-in/download/details.aspx?id=53840
vc_redist.x64.exe
install and run this .exe file in your computer.. the DLL import module error will not appear after this
now it will work fine enjoy :)
I am trying to get scipy running on my computer and I have been fighting for the last few hours with it. Currently, im running python 3.6 and I am on windows 10. I first tried to install it using pip which failed no matter what I did. Then I went and downloaded the wheel file and installed it manually using pip. Then I used pip to get the rest of the dependencies like the website stated pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose. It installed the rest of the packages just fine.
If I say in IDEL
import scipy
It will give me an error of
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from scipy import special, optimize
File "C:\Users\Kevin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\__init__.py", line 116, in <module>
from scipy._lib._ccallback import LowLevelCallable
File "C:\Users\Kevin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\_lib\_ccallback.py", line 1, in <module>
from . import _ccallback_c
ImportError: cannot import name '_ccallback_c'
if I go in that file to comment out that line, it will import but it after that I get a lot more errors anytime I try and do anything.
Also, I tried installing anaconda as a dependency manager and that seemed to work fine for installing, but if I tried to used Atom or IDLE as my text editor it can't seem to find scipy when its compiling and throws and error. I am kinda at a loss and any advice or help on this would be much appreciated. Thank you in advance.