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.
Related
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>
I installed wxPython version 4.1.1 from pip3 and my python version is 3.8.9 on a M1 processor running MacOS Monterey.
Importing wx results in the following exception:
Traceback (most recent call last):
File "myPythonProgram.py", line 1, in <module>
import wx
File "/Library/Python/3.8/site-packages/wx/__init__.py", line 17, in <module>
from wx.core import *
File "/Library/Python/3.8/site-packages/wx/core.py", line 12, in <module>
from ._core import *
ImportError: dynamic module does not define module export function (PyInit__core)
I tried the following options but none of the following seemed to have worked and the result in the same exception, stated above:
Tried wxPython(4.1.1) installation using pip - python3 -m pip install -U --user wxPython==4.1.1
Tried wxPython(4.1.2) with pip3 install -U --user ./wxPython-4.1.2a1.dev5259+d3bdb143-cp38-cp38-macosx_11_0_universal2.whl
Tried compilation/installation of wxPython from source code
Any hints to resolve the issue?
I'm able to resolve the issue using by executing the following steps:
Install native minforge release from here
Create a virtual environment and install wxpython from mini-forge
conda create --name my_env_py38 python=3.8
conda activate my_env_py38
conda install -c conda-forge wxpython # installs wxPython version 4.1.1
I am trying to install the Coral Edge TPU software on MacOS 11.5 by following these instructions:
https://coral.ai/docs/accelerator/get-started/#3-run-a-model-on-the-edge-tpu
But by the time I enter the following command into the console:
python3 examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg
I get the following error:
Traceback (most recent call last):
File "/Users/fabrizio/Desktop/work/MagneticChessResearch/machine learning/Coral/edgetpu_runtime/coral/pycoral/examples/classify_image.py", line 36, in <module>
from pycoral.adapters import classify
ModuleNotFoundError: No module named 'pycoral.adapters'
Any ideas?
I have the same issue on Windows 10. If you are using Python 3.9.x, and used the command pip3 install --extra-index-url https://google-coral.github.io/py-repo/ pycoral to install pycoral, then you will be installing a very old version of pycoral which does not have pycoral.adapters module. I think this is because the pycoral repo currently (June 2021) does not have the package built for Python 3.9.x.
The solution is to either build and install pycoral from source on your Mac using Python 3.9.x, or downgrade Python to 3.8.x and install pycoral again.
I have Python 3.7.3 installed and installed numpy, scipy via pip (cmd -> python -m pip install --user numpy scipy) and am able to import numpy, scipy if I use an admin command prompt to import both numpy and scipy. However, if I don't use an admin cmd prompt, or try to import scipy from the Python shell, I receive traceback errors like the following:
>>> import numpy
>>> import scipy
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
import scipy
ModuleNotFoundError: No module named 'scipy'
Does this traceback error come from not installing scipy in a certain way? Thanks for the help in advance.
When doing checking pip and python versions in cmd, here's my output:
pip --version
pip 19.1 from c:\program files\python37\lib\site-packages\pip (python 3.7)
python --version
Python 3.7.3
Add the location of your python scripts to the Path in Environment Variables.
C:\Users\User_Name\AppData\Roaming\Python\Python37\Scripts
You mentioned that you've already installed the packages. And the packages are stored in the site-packages file inside Python37 folder. So the error must be because you didn't add these to the path.
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.