I'm having troubles getting pybrain working through anaconda - python

Here is my problem:
After I managed to install anaconda (having python 3.4), I apparently managed to install pybrain too. But when i use 'import pybrain' from anaconda or from the terminal too I get this error:
>>> import pybrain
Traceback (most recent call last):
File "<ipython-input-2-0fb7233d2a8c>", line 1, in <module>
import pybrain
File "//anaconda/lib/python3.4/site-packages/PyBrain-0.3-py3.4.egg/pybrain/__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'

Simply running sudo pip3 install git+https://github.com/pybrain/pybrain.git worked for me after having the same issue.
The version up on PyPi isn't Python 3 compatible.
Installing the latest commit directly using pip3 should take care of your old package (from PyPi) as well.

Related

Why cant I import/use installed libraries in Python

I recently downloaded Python 3.10 because I used 3.9. At first, everything worked fine. Sadly, I can't use installed libraries nor use newly downloaded ones, since I deleted Python 3.9. What can I do about this problem?
VSCode gives me this Error message:
Traceback (most recent call last):
File "e:\XXXX\XXXX.py", line 5, in <module>
from playsound import playsound
ModuleNotFoundError: No module named 'playsound'
You can check installed packages using this command:
pip freeze
or
pip list
Uninstall and install using command pip install <package-name>

Anaconda not able to import the packages like numpy, scipy, theano etc

Without installing Anaconda, everything works fine.
That is, I am able to import the above mentioned packages. But after installing Anaconda, I am not able to import the same packages. Here is the error which I get: -
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 199, in <module>
from . import random
File "/usr/local/lib/python2.7/dist-packages/numpy/random/__init__.py", line 99, in <module>
from .mtrand import *
ImportError: /usr/local/lib/python2.7/dist-packages/numpy/random /mtrand.so: undefined symbol: PyFPE_jbuf
Once you install the Anaconda distribution it appends the .bashrc paths with the location of the anaconda/bin.
This means that any python packages installed in the /usr/local/ may not be importable.
I second the suggestion above and recommend using virtual environments to do your work. The Anaconda Python distribution comes with conda package management. This may make your life easier.
You can create a new environments and install packages not provided by the distribution using conda build(http://conda.pydata.org/docs/build_tutorials.html)
Also look at pip and python wheel.

PyBrain in Anaconda - ImportError: No module named 'structure'

I'm looking for a way to use numpy, scipy and pybrain in python. If I try to install those I get the error:
Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
I have installed visual studio but it still doesn't work.
I have tried setting up an environment with conda including numpy and scipy and then installing pybrain in it using pip but when I try to import it I get the error:
import pybrain
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Lucas\Anaconda3\envs\brain\lib\site-packages\pybrain\__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
What should I do?
This seems to be an issue with the library when used from Python 3 and installed using pip. The latest version listed is 0.3.3, but I'm still getting v0.3.0 when installing.
Try installing numpy and scipy in Anaconda, then (after activating the conda environment) install directly from the git repo:
pip install git+https://github.com/pybrain/pybrain.git#0.3.3
This did the trick for me.

Install scikit-learn, numpy import error

I am trying to test scikit-learn library, but didn't manage to install it.
More details : I did install numpy, scipy, matplotlib and I can use them just fine. However, when I use pip (pip install -U scikit-learn), I get this error :
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\...\scikit-learn\setup.py", setup_package()
File "C:\Users\...\scikit-learn\setup.py", from numpy.distutils.core import setup
ImportError: No module named 'numpy'
I couldn't find anything about this.
I tried installing scikit-learn directly by using python setup.py and had the same problem. Any ideas?
Thanks you.
I think there are something wrong with the installation of numpy.
Try download and reinstall following package (for Python 2.7):
http://downloads.sourceforge.net/project/numpy/NumPy/1.9.2/numpy-1.9.2-win32-superpack-python2.7.exe?r=&ts=1442420256&use_mirror=netix

Error in creating LMDB database file in Python for Caffe

I'm trying to create an LMDB data base file in Python to be used with Caffe according to this tutorial. The commands import numpy as np and import caffe run perfectly fine. However, when I try to run import lmdb and import deepdish as dd, I'm getting the following errors:
>>> import lmdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lmdb
>>> import deepdish as dd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named deepdish
I'm running Python 2.7.9 through Anaconda 2.2.0 (64-bit) on Ubuntu 14.04. While installing the dependencies for Caffe according to this page, I've already installed the lmdb package through sudo apt-get install liblmdb-dev.
Any ideas why this error might be occuring?
Well, the apt-get install liblmdb-dev might work with bash (in the terminal) but apparently it doesn't work with Anaconda Python. I figured Anaconda Python might require it's own module for lmdb and I followed this link. The Python installation for lmdb module can be performed by running the command pip install lmdb in the terminal. And then import lmdb in Python works like a charm!
The above installation commands may require sudo.
If you're using Anaconda, then this can solve your problem (it worked for me):
conda install -c https://conda.binstar.org/dougal lmdb
For Anaconda users, installing python-lmdb package from conda-forge should fix the lmdb import error:
conda install -c conda-forge python-lmdb
This was tested on conda 4.5.11 on an lxc-containerized system running Ubuntu 18.04.
Note that there is a conda package named lmdb (without python-), installable via:
conda install -c conda-forge lmdb
that does not fix the import error.

Categories

Resources