Using PYMC3 on Windows 10 - theano cannot import name 'floatX' - python

I'm struggling to get PYMC3 to install correctly on windows. I've tried using the Anaconda package via conda install -c conda-forge pymc3 and in a virtualenv using only pip as per the documentation.
It seems to install ok, but fails when running an import pymc3 with the following error. Research suggests that there may be some dependencies which are getting missed.
>>> import pymc3
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10). Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29
ERROR (theano.sandbox.cuda): nvcc compiler not found on $PATH. Check your nvcc installation and try again.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\__init__.py", line 8, in <module>
from .sampling import *
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\sampling.py", line 11, in <module>
from .step_methods import (NUTS, HamiltonianMC, Metropolis, BinaryMetropolis,
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\__init__.py", line 3, in <module>
from .hmc import HamiltonianMC
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\__init__.py", line 1, in <module>
from .hmc import HamiltonianMC
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\hmc.py", line 7, in <module>
from .base_hmc import BaseHMC
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\base_hmc.py", line 2, in <module>
from .trajectory import get_theano_hamiltonian_functions
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\trajectory.py", line 3, in <module>
from pymc3.theanof import join_nonshared_inputs, gradient, CallableTensor, floatX
ImportError: cannot import name 'floatX'
I can't find much out there about this floatx package.
Seems to be a windows thing - as it installed and runs no problems on my old Ubuntu box (with anaconda).
Any help gratefully received!
EDIT: Step closer. For some reason I had the path to the nvcc compiler wrong. So if you suffer the same check that you have the full path including "\bin" in your environmnental path. If you make a change don't forget to restart.
Now I get an error:
>>> import pymc3
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10). Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29
Using gpu device 0: GeForce GTX 960M (CNMeM is disabled, cuDNN not available)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\__init__.py", line 4, in <module>
from .distributions import *
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\__init__.py", line 1, in <module>
from . import timeseries
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\timeseries.py", line 1, in <module>
import theano.tensor as tt
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\__init__.py", line 116, in <module>
theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\sandbox\cuda\tests\test_driver.py", line 32, in test_nvidia_driver1
profile=False)
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\function.py", line 326, in function
output_keys=output_keys)
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\pfunc.py", line 486, in pfunc
output_keys=output_keys)
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 1795, in orig_function
defaults)
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 1661, in create
input_storage=input_storage_lists, storage_map=storage_map)
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\link.py", line 699, in make_thunk
storage_map=storage_map)[:3]
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\vm.py", line 1098, in make_all
self.updated_vars,
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\vm.py", line 952, in make_vm
vm = CVM(
NameError: name 'CVM' is not defined
>>>
This I fixed with the last post here: https://groups.google.com/forum/#!msg/theano-users/JoTu61_MTLk/4ZzsVyaOf2kJ. But now stuck with an error:
>>> import pymc3
Traceback (most recent call last):
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 306, in <module>
from cutils_ext.cutils_ext import * # noqa
ImportError: No module named 'cutils_ext.cutils_ext'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 317, in <module>
from cutils_ext.cutils_ext import * # noqa
ImportError: No module named 'cutils_ext.cutils_ext'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\__init__.py", line 4, in <module>
from .distributions import *
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\__init__.py", line 1, in <module>
from . import timeseries
File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\timeseries.py", line 1, in <module>
import theano.tensor as tt
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\__init__.py", line 80, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\scan_module\__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\scan_module\scan_opt.py", line 60, in <module>
from theano import tensor, scalar
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\tensor\__init__.py", line 9, in <module>
from theano.tensor.subtensor import *
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\tensor\subtensor.py", line 26, in <module>
import theano.gof.cutils # needed to import cutils_ext
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 320, in <module>
compile_cutils()
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 285, in compile_cutils
preargs=args)
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2313, in compile_str
return dlimport(lib_filename)
File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 302, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
ImportError: DLL load failed: The specified procedure could not be found.
>>>
The investigation continues! Maybe it's time to bin windows and move to linux full time!
EDIT2: I switched to a python 2.7 environment and it seems to work ok. Had to install http://mingw.org/ but after that all ok.
Would be nice to get it to work in 3.6 though. Thoughts anyone?

Ok, I managed to cobble an install together.
I had no luck with the dependency management etc using conda install -c conda-forge pymc3, and I couldn't be sure if there were issues with locations/paths to compilers etc. So I did a re-install from the start.
I went for Anaconda3 (rather than 2) and it worked fine.
1) I followed the environment setup here https://github.com/philferriere/dlwin until I got to the point of installing Theano. But instead of the version suggested I installed the latest with conda install -c rdonnelly Theano suggested by https://github.com/nouiz. This is a nice solid environment set up - and i really recommend the msys tool - I hadn't used it before.
The test script in the philferriere guide are a good way to test function/performance.
2) Then I set up pymc3 using pip install pymc3 as they suggest here https://github.com/pymc-devs/pymc3. but NOT the latest version on git.
Hope someone finds this useful.
Refs:
https://github.com/Theano/Theano/issues/5348

Related

DLL load failed while importing cv2 Not enough memory resources are available to process this command

My Input
python model_main_tf2.py --model_dir=models\my_ssd_mobilenet_v2_fpnlite --pipeline_config_path=models\my_ssd_mobilenet_v2_fpnlite\pipeline.config
Output
Traceback (most recent call last):
File "model_main_tf2.py", line 32, in <module>
from object_detection import model_lib_v2
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py", line 29, in <module>
from object_detection import eval_util
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\object_detection\eval_util.py", line 36, in <module>
from object_detection.metrics import lvis_evaluation
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\object_detection\metrics\lvis_evaluation.py", line 23, in <module>
from lvis import results as lvis_results
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\lvis\__init__.py", line 5, in <module>
from lvis.vis import LVISVis
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\lvis\vis.py", line 1, in <module>
import cv2
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\cv2\__init__.py", line 5, in <module>
from .cv2 import *
ImportError: DLL load failed while importing cv2: Not enough memory resources are available to process this command.
I try pip install opencv-python and other And I research but ı not found this error There is 20 gb of free space on the computer My reference https://github.com/armaanpriyadarshan/Training-a-Custom-TensorFlow-2.x-Object-Detector Please Help me.
I was having the same issue while training a model using tensorflow object detection API for custom dataset.
I struggled a lot in starting but in end i did
conda update -c conda-forge --all
I don't know why but it worked for me.

"This package should not be accessible on Python 3" error

I installed phenix (phenix-installer-1.17.1-3660-intel-linux-2.6-x86_64-centos6) on my CentOS 7 system according the installation guide (https://www.phenix-online.org/documentation/install-setup-run.html). The original python version (/usr/bin/python) in my system is 2.7.5, but I installed anaconda3, so the output of "which python" command is "~/software/build/anaconda3/bin/python".
I tried to study the p9-sad tutorial and run the command "phenix.run_example p9-sad", but it gave the following error information:
Examples to be run: p9-sad
Running PHENIX example: p9-sad Fri Jan 17 15:04:44 CST 2020
Working directory: /home/sunyp/Documents/tutorial/PHENIX/p9-sad
Starting run now ... please wait a moment
Error processing line 1 of /home/sunyp/software/build/anaconda3/lib/python3.7/site-packages/google_auth-1.7.1-py3.6-nspkg.pth:
Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "/home/sunyp/software/build/anaconda3/lib/python3.7/importlib/util.py", line 14, in <module>
from contextlib import contextmanager
File "/home/sunyp/software/build/anaconda3/lib/python3.7/contextlib.py", line 5, in <module>
from collections import deque
File "/home/sunyp/software/build/anaconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
from reprlib import recursive_repr as _recursive_repr
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/build/../conda_base/lib/python2.7/site-packages/site.py", line 73, in <module>
__boot()
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/build/../conda_base/lib/python2.7/site-packages/site.py", line 22, in __boot
loader.load_module('site')
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 570, in <module>
main()
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 557, in main
known_paths = addsitepackages(known_paths)
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 349, in addsitepackages
addsitedir(sitedir, known_paths)
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 207, in addsitedir
addpackage(sitedir, name, known_paths)
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 178, in addpackage
import traceback
File "/home/sunyp/software/build/anaconda3/lib/python3.7/traceback.py", line 3, in <module>
import collections
File "/home/sunyp/software/build/anaconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
from reprlib import recursive_repr as _recursive_repr
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Does it mean that phenix requires python2 rather python3, but there is python3 in my system, so the error came out? And how to solve the problem? Thank you in advance.
Regards,
Yeping Sun
Solely based on /home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py Phenix contains a Python 2.7 environment.
You could maybe try running your code with /home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/bin/python or something to use that Python interpreter, but it's hard to tell since Phenix source is not openly available.
Your environment probably contains path to python2.7.5
Check your PYTHONPATH
This doesn't work with Python 3 for obvious reasons. To remove it:
unset PYTHONPATH

Error installing Spyder in anaconda

Tried anaconda today , it seems fine but when I tried to launch Spyder each time I get this error: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 6, in <module>
from spyder.app.start import main
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 23, in <module>
from spyder.utils.external import lockfile
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\external\lockfile.py", line 22, in <module>
import psutil
File "C:\Users\Jaker\AppData\Roaming\Python\Python36\site-packages\psutil\__init__.py", line 126, in <module>
from . import _pswindows as _psplatform
File "C:\Users\Jaker\AppData\Roaming\Python\Python36\site-packages\psutil\_pswindows.py", line 16, in <module>
from . import _psutil_windows as cext
ImportError: cannot import name '_psutil_windows'
Any help regarding this ? Also how do I get python 3.6.3 in anaconda..?
The problem is you have two Python versions installed in your system: one in C:\ProgramData\Anaconda3\ and the other in C:\Users\Jaker\AppData\Roaming\Python\Python36.
Please uninstall one of them and the problem will be solved.

Python: pip is installed but not working in windows

I have installed python 3.6.0, you don't need to install pip manually if you are using python (>3.3). But When I am trying to access pip (pip --version), it throws me two errors which mainly relate to not finding the module.
Description is given below.
C:\Users\sharma6>pip --version
Traceback (most recent call last):
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 27, in <module>
from . import urllib3
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 7, in <module>
from socket import error as SocketError, timeout as SocketTimeout
File "c:\python360\lib\socket.py", line 49, in <module>
import _socket
zipimport.ZipImportError: can't find module '_socket'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python360\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python360\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\python360\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\python360\lib\site-packages\pip\__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "c:\python360\lib\site-packages\pip\_vendor\requests\__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 29, in <module>
import urllib3
ModuleNotFoundError: No module named 'urllib3'
Even when I import socket (>>>import socket)in python interpreter , It shows me "Can not found the module" error .
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python352\lib\socket.py", line 49, in <module>
import _socket
zipimport.ZipImportError: can't find module '_socket
Could someone tell me about the errors and how to resolve them because I need pip to work properly.
Add your all path in your system variable instead of adding in user variable.
It worked for me!!! :)
You should try to write
python -m pip --version
If this gives an error message, install pip by downloading get-pip.py from https://pip.pypa.io/en/stable/installing/ and install with
python get-pip.py
Installing with pip is then done by
python -m pip install [package name]

Installing numba onto Linux 7.0 - error with prerequisite llvmlite library diectory

I'm new to Linux and generally installing packages via command line syntax.
I've tried installing numba (to use jit) into Python and this is the error I receive.I did this originally with GitHub source, and again with Anaconda. Numba appear to be installed correctly in the command line, however when I try to import into Spyder I get the below error
llvmlite imports without error.
>>> import numba
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/numba-0.22.1_13.g1902d7f-py2.7-linux-x86_64.egg/numba/__init__.py", line 7, in <module>
from . import testing, decorators
File "/usr/local/lib/python2.7/dist-packages/numba-0.22.1_13.g1902d7f-py2.7-linux-x86_64.egg/numba/testing.py", line 6, in <module>
from numba import config
File "/usr/local/lib/python2.7/dist-packages/numba-0.22.1_13.g1902d7f-py2.7-linux-x86_64.egg/numba/config.py", line 9, in <module>
import llvmlite.binding as ll
File "/usr/local/lib/python2.7/dist-packages/llvmlite-0.0.0-py2.7.egg/llvmlite/binding/__init__.py", line 6, in <module>
from .dylib import *
File "/usr/local/lib/python2.7/dist-packages/llvmlite-0.0.0-py2.7.egg/llvmlite/binding/dylib.py", line 4, in <module>
from . import ffi
File "/usr/local/lib/python2.7/dist-packages/llvmlite-0.0.0-py2.7.egg/llvmlite/binding/ffi.py", line 43, in <module>
lib = ctypes.CDLL(_lib_name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libllvmlite.so: cannot open shared object file: No such file or directory

Categories