Get ImportError after installing EttusResearch UHD with Conda - python

I installed UHD with Conda using the conda install -c conda-forge uhd command. Then I ran conda install uhd. When I try to import uhd in Python3.6, I get an ImportError:
>>> import uhd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/asamant/miniconda3/lib/python3.6/site-packages/uhd/__init__.py", line 10, in <module>
from . import types
File "/home/asamant/miniconda3/lib/python3.6/site-packages/uhd/types.py", line 10, in <module>
from . import libpyuhd as lib
ImportError: libudev.so.0: cannot open shared object file: No such file or directory

The dependency on libudev cannot be shipped via conda-forge and therefore you yourself have to make sure it is available.
You need to install alibudev-0.x package manually (libudev1 won't work!)
The easiest way to solve this is to use your system's package manager, e.g. apt-get install libudev1 for Ubuntu.
It looks to me as if libudev.so.0 is different from libudev.so.1 shipped via the libudev1 package by the ubuntu package manager.
There seem to be ways around, but it is not a beautiful solution: https://askubuntu.com/questions/729067/libudev0-is-not-installed

Related

import Spacy on RPI in Pycharm and other IDE gives error

I successfully installed Spacy using pip install spacy and alternatively through Pycharms virtual env, but when I import spacy in my program it's giving me the following error;
home/pi/.virtualenvs/cv/bin/python /home/pi/PycharmProjects/testSpeech/main.py
Traceback (most recent call last):
File "/home/pi/PycharmProjects/testSpeech/main.py", line 2, in <module>
import spacy
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/spacy/__init__.py", line 10, in <module>
from thinc.neural.util import prefer_gpu, require_gpu
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/thinc/neural/__init__.py", line 4, in <module>
from ._classes.model import Model # noqa: F401
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/thinc/neural/_classes/model.py", line 11, in <module>
from ..train import Trainer
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/thinc/neural/train.py", line 7, in <module>
from .optimizers import Adam, linear_decay
File "thinc/neural/optimizers.pyx", line 14, in init thinc.neural.optimizers
File "thinc/neural/ops.pyx", line 36, in init thinc.neural.ops
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/blis/__init__.py", line 3, in <module>
from .cy import init
ImportError: /home/pi/.virtualenvs/cv/lib/python3.7/site-packages/blis/cy.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_load_8
Process finished with exit code 1
Any idea what's happening?
You probably have a 32-bit OS? Instead, you will need a 64-bit OS with 64-bit python for spaCy v2, e.g.: https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2020-08-24/
As of spacy v2.3.5 you should be able to install spacy in a venv for linux aarch64 with:
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools
pip install spacy
Alternatively, there are binary linux aarch64 packages on conda-forge. There's a linux aarch64 miniforge installer and the install command would be conda install spacy. If you're not using the miniforge installer, then you need to add -c conda-forge or otherwise add the conda-forge channel.
See: https://github.com/explosion/spaCy/issues/6638
There was some problem while loading some library which was some prerequisite for spacy.
The problem was solved by calling the file via terminal with the following command;
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3 main.py

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.

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.

I'm having troubles getting pybrain working through anaconda

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.

Installing PySide on OSX 10.6.8

Trying to get my feet wet with PySide development but having trouble
getting setup. I tried installing the binaries 1.0.4-r1 and 1.0.5 but
both of those produced the following message on import PySide
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
import private
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
from QtCore import __moduleShutdown
ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/
QtCore.so, 2): Library not loaded: QtCore.framework/Versions/4/QtCore
Referenced from: /Library/Python/2.6/site-packages/PySide/QtCore.so
Reason: image not found
Then I tried doing the install from the gitorious build scripts. Using
sudo ./dependencies.osx.sh. After that completed I now get the
following error on import PySide.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
ImportError: No module named QtCore
Any advice is appreciated. I'm using QtCreator 2.2.1 and Qt SDK
1.1.2 / Qt Library 4.7.3. Thank you!
Try to install latest version MacPorts and python 2.7 first and set python2.7 as default python version:
sudo port install python27
port select --list python
sudo port select --set python python27
then re-install PySide again:
sudo port install py27-pyside
I just encountered exactly the same problem:
Library not loaded: QtCore.framework/Versions/4/QtCore
You need to find installed QT libraries and make them visible to the dynamic linker.
My Qt*.framework folders live in /usr/local/lib (Qt is installed with Homebrew package manager). So, I added
export DYLD_FRAMEWORK_PATH=/usr/local/lib:$DYLD_FRAMEWORK_PATH
to ~/.bash_profile and restarted the console.
That's it.
I just solved the same problem by using homebrew to install pyside.
$ sudo -H pip uninstall pyside
$ brew install pyside

Categories

Resources