ImportError: No module named labjack - python

I am getting the following error while using python with T7 labjacks.
from labjack import ljm
# Open first found LabJack
handle = ljm.openS("ANY", "ANY", "ANY")
# Call eReadName to read the serial number from the LabJack.
name = "SERIAL_NUMBER"
result = ljm.eReadName(handle, name)
Error is:
Traceback (most recent call last):
File "testLJ.py", line 1, in <module>
from labjack import ljm
ImportError: No module named labjack

As documented on Labjack - Python for LJM - Windows, Mac, Linux:
Instructions
Install the LJM Python modules with pip, which is
commonly installed with Python, using the following command:
python -m pip install labjack-ljm
or:
pip install labjack-ljm
Troubleshooting
If you get the following error:
ImportError: No module named labjack
Make sure you install for the Python version you will be using. For
example, on Linux if both Python 2.7 and 3.5 are installed, you can
install to Python 3.5 with:
$ python3.5 -m pip labjack-ljm install

Related

Unable to use a installed Python package

I used pip install aesthetic-ascii to install an ASCII image creator for my Python 3, but when I run the code, it gives me this:
Traceback (most recent call last): File "c:/Users/(USER)/Programming/PY 3/Programs/Aesthetic ascii testing.py", line 1, in <module> from aesthetic_ascii import synthesize ModuleNotFoundError: No module named 'aesthetic_ascii'
code:
# initialize drive object (to generate visuals)
drive = synthesize.Drive()
# generate a ASCII visual (dark_mode optional)
drive.generate(dark_mode=True)
# save to png
drive.to_png('aesthetic.png')
the program is from https://pypi.org/project/aesthetic-ascii/
Which version of python are you running the code? If you have both, python2 and python3 installted, the pip for python3 is called pip3. Try this:
pip3 install aesthetic-ascii
If you are not sure about which pip to use, you can call pip with the python version you are using:
python3 -m pip instal aesthetic-ascii

ModuleNotFoundError : no module named 'pycorenlp'

I need to install python wrapper for StanfordCoreNLP.
I have used git clone https://github.com/smilli/py-corenlp and also pip install pycorenlp and its showing success in both the cases, but when I run from pycorenlp import StanfordCoreNLP, its showing ModuleNotFoundError.
I checked its path if it installed or not. It is installed at "C:\Users\simra_000\Anaconda3\Lib\site-packages\pycorenlp" using pip
and using git clone also it is installed at "C:\Users\simra_000\py-corenlp"
from pycorenlp import StanfordCoreNLP
Traceback (most recent call last): File "", line 1, in
ModuleNotFoundError: No module named 'pycorenlp'
check if the module was installed by:
pip list
also you can add this code to install the module if it's not installed:
import pip
required_pkgs = ['pycorenlp']
installed_pkgs = [pkg.key for pkg in pip.get_installed_distributions()]
for package in required_pkgs:
if package not in installed_pkgs:
with suppress_stdout():
pip.main(['install', package])
also check the version of python that you are used to run the script and the version of pip, for example if you are using python3 and you install the module via pip (python2) the module was installed for python v.2 only
otherwise check the name of your script, so if the name of your script is pycorenlp.py the import will not work, and you need to change the name of your script
hope that helps you

Pip3.5 points to old Python 3.4.2 after Python 3.5 installation

I have installed Python 3.5.4 alongside python 3.4.2.
Calling pip with python 3.4 works fine, that is:
>>pip3.4
>>py -3.4 -m pip
Trying to use the python 3.5 version of pip (which I have ticked to install during the installation) with:
>>pip
>>python -m pip
>>py -3.5 -m pip
All lead to this error:
Could not import runpy module
Traceback (most recent call last):
File "C:\Python34\Lib\runpy.py", line 14, in <module>
import importlib.machinery # importlib first so we can test #15386 via -m
File "C:\Python34\Lib\importlib\__init__.py", line 34, in <module>
_w_long = _bootstrap._w_long
AttributeError: module 'importlib._bootstrap' has no attribute '_w_long'
This is on a Windows 7 64bit PC. I have no idea why specifically calling the python 3.5 version of pip makes it to access python 3.4's directory as in "C:\Python3.4". Help?
have you try to configure the environment variable properly?
See this link:
python and pip windows configuration

Unable to import owlready in Python

I am trying to use the owlready library in Python. I downloaded the file from link(https://pypi.python.org/pypi/Owlready) but when I am importing owlready I am getting following error:
>>> from owlready import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'owlready'
I tried running:
pip install owlready
I am get the error:
error: could not create '/usr/local/lib/python3.4/dist-packages/owlready': Permission denied
Try installing it using pip instead.
Run the command pip install <module name here> to do so. If you are using python3, run pip3 install <module name here>.
If neither of these work you may also try:
python -m pip install <module name here>
or
python3 -m pip install <module name here>
If you don't yet have pip, you should probably get it. Very commonly used python package manager. Here are some details on how to set the tool up.
You need installed library:
C:\PythonX.X\Scripts
pip install owlready
Successfully installed Owlready-0.3

Mac reinstall Python

I tried to use the Coursera course downloader from here and it worked for few courses but not all. They have recommended to use Python3.X. So I uninstalled Anaconda (version 2) from my Mac and installed Python3.5.1 from Python's website but still the course downloaders did not work as it was using default Python 2.7.
So I deleted Python from /usr/local/lib and now nothing is working. When I do which python it shows ``usr/local/bin/pythonand bothpythonandpython3` runs.
But when I do pip install coursera it throws error as follows:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
And when I do sudo easy_install pip, I get the following error.
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
try Homebrew http://brew.sh/
brew install python3
curl bootstrap.pypa.io/get-pip.py | python3
Your Mac should have Python 2 and Python 3 installed by default. in the terminal "python" will launch Python2, "python3" will launch Python3. With Anaconda you could have just kept the Python 2 version and created an environment for Python 3, http://conda.pydata.org/docs/using/envs.html#managing-environments.
This is the solution you will most likely need, No module named pkg_resources. Setuptools is causing the issue and you will need to wget ez_setup.py. Reinstalling Anaconda will save you a lot of time and pain.

Categories