AttributeError: module 'theano' has no attribute 'tests' - python-3.x

I am trying to use theano gpu on my ubuntu, but each time after it running one time successfully, it will give me the error like this when I try to run next time. No idea why, could anyone help me ?
import theano
Traceback (most recent call last):
File "", line 1, in
File "/home/sirius/anaconda3/lib/python3.5/site-packages/theano/init.py", line 95, in
if hasattr(theano.tests, "TheanoNoseTester"):
AttributeError: module 'theano' has no attribute 'tests'

I met the same problem.I just fix it with conda install nose

For latest version of Theano (1.04)
import theano generates an error without the nose package installed
install via conda or pip pip install nose / conda install nose

Related

Rpy2 import rpy2.robjects as robjects fails

I've installed rpy2 through pip install rpy2. After this in a Jupyter notebook the import works fine:
import rpy2
print(rpy2.__version__)
which returns 3.1.0.
However when I type this import rpy2.robjects as robjects, I get the following error:
ValueError: The system "%s" is not supported.
Does someone know where this error comes from and how to solve it?
I had exactly the same problem.
I uninstalled the package and reinstalled it with conda (as I use Jupyter notebook through Anaconda):
conda install rpy2
Doing this it worked just fine.
The version installed was 2.9.4. There may be an issue with the version 3.1.0 I believe.
I have a similar problem. I had previously installed rpy2 2.9.5 withpip3 install rpy2 and it worked fine. However, today I tried updating it with pip3 install --upgrade rpy2 and got the following error:
Collecting rpy2
Using cached https://files.pythonhosted.org/packages/62/bc/d43df0d9e96a38985a97d1cbdb5722e10cd8fa0da45686972f0b8fd18a67/rpy2-3.2.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-irk23ljv/rpy2/setup.py", line 21, in <module>
from rpy2 import situation
File "/tmp/pip-build-irk23ljv/rpy2/rpy2/situation.py", line 98
raise ValueError(f'The system {system} is currently not supported.')
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-irk23ljv/rpy2/
I can't just stick to the older version because what I'm actually trying to do is to install another Python package that has rpy2 listed as a dependency. The install fails with the same error message.
Any update on the subject?
Edit
It looks like this might be a compatibility issue with Python 3.5 -- see https://bitbucket.org/rpy2/rpy2/issues/580/installing-rpy2-on-travis-with-pip. I've just opened an issue here: https://github.com/rpy2/rpy2/issues/356

Spyder won't start in cmd

When I try to run spyder (any version of spyder) in cmd I get the error below.
Traceback (most recent call last):
File "C:\Users\bjwil\Anaconda3\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\spyder\app\start.py", line 186, in main
from spyder.app import mainwindow
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py", line 87, in <module>
from qtpy import QtSvg # analysis:ignore
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\qtpy\QtSvg.py", line 14, in <module>
from PyQt5.QtSvg import *
ImportError: DLL load failed: The specified procedure could not be found.
I do not get this error when run spyder in MinGW Git for Windows. I have looked for a few hours but cannot seem to find answer to why. I have the python3.dll and python36.dll extension from Anaconda3 in the Anaconda3 folder. I also cannot uninstall PyQt5 (getting PackagesNotFoundError: The following packages are missing from the target environment:
- pyqt5) and reinstall using either conda install -c dsdale24 pyqt5 or conda install --channel https://conda.anaconda.org/bpentz pyqt5. I get:
Collecting package metadata: done
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- conda[version='>=4.6.7']
- pyqt5
Use "conda search <package> --info" to see the dependencies for each package.
conda update --all fixed the same issue for me.
There may different reason for this problem. Sometimes it is because you forget to install spyder in the anaconda environment.
You can install Spyder from anaconda prompt by running
conda install spyder
Also, you can install spyder by going to the anaconda navigator.

When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'

I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error:
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 980, in _find_and_load SystemError:
<class '_frozen_importlib._ModuleLockManager'> returned a result with
an error set ImportError: numpy.core._multiarray_umath failed to
import ImportError: numpy.core.umath failed to import
I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python.
I am using Windows10.
I also had the same issue.
It got resloved once I upgraded the numpy from 1.15.4 to 1.16.1.
If you're using pip:
pip install numpy --upgrade
Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked.
Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me.
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there.
Please use the below mentioned statement for this purpose
conda install -c anaconda numpy
Also make sure that the numpy version supports the Python version you are using.
You can use two options in python 3.6
Install
py pip -m install numpy==1.14.5
Upgrade
py pip install numpy --upgrade
Note: the version most recently is 1.14.5
I also had this issue with python 3.8.9 and Numpy 1.24.1.
Downgrading to Numpy 1.21.0 fixed the issue.

python3 "ModuleNotFoundError: No module named 'OpenGL'"

I am running python3. I've installed OpenGL (pip install OpenGL PyOpenGL_accelerate). When I run my program (python3 opengltest1.py) I get this error:
Traceback (most recent call last):
File "opengltest1.py", line 4, in <module>
from OpenGL.GL import *
The solution was to install OpenGL with pip3 instead of pip, i.e.
pip3 install pyopengl
#eyllanesc Thanks for the help. In following up on your suggestion, I found the solution.
This worked for me! You must download every package with pip3. All things are separated because the syntax is different from Python 2 to Python 3.

pip isn't working when importing something

To install pymongo for pypy3 2.1 Beta 1, I installed pip using the following commands:
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
./pypy ez_setup.py --user
where pypy is the executable of pypy3 2.1 Beta 1. After that, pip and pip-3.2 will come to the current directory. But when running pip or pip-3.2, I get the error:
Traceback (most recent call first):
File "pip-3.2", line 5, in <module>
from pkg_resources import load_entry_point
zipimport.ZipImportError: pip==1.4.1
It seems that the problem comes from from pkg_resources import load_entry_point of the pip/pip-3.2. But this statement runs OK when I put it in pypy or python3 IDLE. What's the matter? How to solve this problem and proceed to install pymongo for pypy3 2.1 Beta 1? Thank you.
PS: I'm using Ubuntu. python3 is installed in the system. If u need any other information pertaining to solving the question, please comment.

Resources