ModuleNotFoundError: No module named 'jpype' - python

I am using Anaconda Python and used the following to install jpype:
conda install -c conda-forge jpype1
I have GCC installed:
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
and I did not get any error during installation.
conda install -c conda-forge jpype1
Collecting package metadata: done
Solving environment: done
# All requested packages already installed.
If I run pip search jpype I will get the following:
jtypes.jpype (0.6.3b3) - A Python to Java bridge (ctypes/cffi-based JPype).
JPype1-py3 (0.5.5.2) - Python-Java bridge. Fork of the jPype project by Steve Menard (http://jpype.sourceforge.net/), with the modifications applied by Luis Nell
(https://github.com/originell/jpype)
but still cannot call the library
>>> import jpype
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'jpype'

It might be because it is installed as a Python 2 package and you're running Python 3 or the opposite.
To specifically install the package for Python 3, try entering this command:
pip3 install jpype1
or
python3 -m pip install jpype1
To specifically install the package for Python 2, try entering this command:
pip2 install jpype1
or
python -m pip install jpype1

I found the problem.
By mistake, I had two versions of Anaconda 3.6 and 3.7 which was causing the problem.

Related

cannot install library python

i want to install the library telethon
It says i should execute this line of code
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade telethon
The first command works, it has a bunch of warnings but it seems to work.
But the second command says:
ERROR: Could not find a version that satisfies the requirement telethon (from versions: none) ERROR: No matching distribution found for telethon
So what i am doing wrong?
I am using windows
To install a virtual env and your package:
$ python --version
Python 3.6.9
$ python -m venv venv
$ source venv/bin/activate
(venv)$ pip install -U pip setuptools
(venv)$ pip install telethon
(venv)$ python
Python 3.6.9 (default, Jun 13 2020, 20:27:45)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Now try to load telethon:
>>> import telethon
>>> telethon.__version__
'1.23.0'
I have found the solution:
I just have to run VS code editor as "admin"

How to install pyaudio module in the current version of python while having multiple versions of python installed?

I have installed multiple versions of python like 3.8.5 and 3.9.2 in my Linux Ubuntu system. I want to install pyaudio module in 3.9.2 version.
For this, I have used a command: pip3 install PyAudio and I am getting this error - error: Microsoft Visual C++ 14.0 is required.
I have also used python unofficial libraries and tried to install pyaudio but it shows this error -
ERROR: PyAudio-0.2.11-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.
Then I used these commands for the same -
sudo apt-get install libasound-dev portaudio19-dev libportaudio2
libportaudiocpp0
sudo apt-get install ffmpeg libav-tools
sudo pip install pyaudio
After this when I import pyaudio module, it shows module not found error. But when I tried to re-install the module, it shows requirement already satisfied.
Then I executed the command:
sudo -s
python3
import pyaudio
Now it shows no error. It seems that pyaudio module has been installed in python 3.8.5 version and not in python 3.9.2 version. However, I used virtual environment of older python version and installed speech recognition, pyaudio which worked well.
I want to use pyaudio module without using virtual environment without any errors. Please help.
Here is the screenshot of the issueimage_pyaudio_issue
Here is the code -
maaz#maaz-HP-Notebook:~$ python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pyaudio
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pyaudio
import PyAudio
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named PyAudio
exit()
maaz#maaz-HP-Notebook:~$ sudo pip install pyaudio
[sudo] password for maaz:
Requirement already satisfied: pyaudio in /usr/lib/python3/dist-packages (0.2.11)
maaz#maaz-HP-Notebook:~$ sudo -s
[sudo] password for maaz:
root#maaz-HP-Notebook:/home/maaz# python3
Python 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import pyaudio
exit()
root#maaz-HP-Notebook:/home/maaz# exit
exit
Check in the usr/bin and usr/local/bin for all python instances.
The installation of python3 is probably linked to python 3.8.5. But there might be a python3.9.
You could check for other python instances in the above folders by running the below commands:
ls -ls /usr/bin/python*
ls -ls /usr/local/bin/python*
If so, you can run the commands with python3.9, but i would recommend cleaning up the unused installations.

Installing Rasterio on Ubuntu fails with ImportError

I have an AWS EC2 p2.xlarge instance running on Ubuntu 16.04.4 LTS that was created using the AWS Deep Learning AMI (DLAMI). I am using the keras/Tensor Flow conda environment:
$ source activate tensorflow_p36
I am attempting to install Rasterio and GDAL on top of the Keras - Tensor Flow AMI installations using these commands (source):
$ sudo add-apt-repository ppa:ubuntugis/ppa
$ sudo apt-get update
$ sudo apt-get install python-numpy gdal-bin libgdal-dev
$ pip install rasterio
The GDAL install seems to work:
$ gdalinfo --version
GDAL 2.1.3, released 2017/20/01
However, when I try to import rasterio in Python, it yields the following error:
(tensorflow_p36) ubuntu#ip-171-11-7-03:~$ python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rasterio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/anaconda3/envs/tensorflow_p36_test/lib/python3.6/site-packages/rasterio/__init__.py", line 15, in <module>
from rasterio._base import (
ImportError: /usr/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name
>>>
How can I clear this error so that I can import and use rasterio in Python?
I had a similar issue trying to import rasterio with GDAL 2.x installed. You should try to install GDAL 1.11 instead.

No module named 'pafy'

sudo pip3.6 install pafy
Collecting pafy
Downloading pafy-0.5.3.1.tar.gz
Installing collected packages: pafy
Running setup.py install for pafy ... done
Successfully installed pafy-0.5.3.1
It is Successfully installed pafy-0.5.3.1.
~$ python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pafy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pafy'
Why no module named 'pafy'?
You ran pip as sudo but you're running python as normal user. Programs run as normal user don't have rights to access super-user's content (sudo).
To verify this, you can run python as super-user and try to import pafy.
$ sudo python
>>> import pafy
You should never use sudo pip install; you could overwrite important stuff.
Use pip install --user <packagename> or install and use virtualenv. I prefer virtualenv.
pip install pafy
This would work

Installation of nltk-3.0a3 for python3.3.3 - "ImportError: No module named 'setuptools'"

I have installed Python 3.3.3 with a command:
sudo apt-get install python3
I am calling it as Python3, because I have Python 2.7 installed as well.
I have also installed distribute (setuptools) with a command:
sudo apt-get install python3-setuptools
To be sure, setuptools are installed for python3, I have searched with pip3 and I received an output:
$ pip3 search setuptools
setuptools - Easily download, build, install, upgrade, and
uninstall Python packages
INSTALLED: 2.0 (latest)
Now I want to install NLTK's version for Python 3, so nltk3.0a3. I have downloaded it from the official site, and in the folder I ran a standard python installation and received an output:
$ python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 33, in <module>
from setuptools import setup, find_packages
ImportError: No module named 'setuptools'
And in fact, when I go to python3 command line, for that input, I see the output:
>>> help('modules setup')
ez_setup - Bootstrap setuptools installation
setup
unittest.test.test_setups
So there is really no module called setuptools...
Does anyone know what am I doing wrong? Or is there any other way of installing NLTK for python 3? (in apt, there is only NLTK for python 2).
Thanks a lot guys for any effort!
You can use muon or your favorite package manager to install python3-setuptools and an experimental version of nltk supporting Python 3 is available at http://nltk.org/nltk3-alpha/
I suspect you will also need pyyaml and numpy installed for your python 3.
I gave this a try:
muon
check that I have installed python3-setuptools and python3-numpy
sudo pip3 install pyyaml
Having downloaded and unpacked the code from the above link
cd ~/ToolBuild/nltk-3.0a3/nltk-3.0a3
sudo python3 setup.py install
python3
Python 3.3.2+ (default, Oct 9 2013, 14:50:09)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> dir(nltk)
['AbstractLazySequence', 'AffixTagger', 'AlignedSent', 'Alignment', 'AnnotationTask', 'Assignment', 'BigramAssocMeasures', 'BigramCollocationFinder', 'BigramTagger', 'BinaryMaxentFeatureEncoding', 'BlanklineTokenizer', 'BottomUpChartParser', 'BottomUpLeftCornerChartParser', 'BottomUpProbabilisticChartParser', 'Boxer', 'BrillTagger', 'BrillTaggerTrainer', 'CfgReadingCommand', 'ChartParser', 'ChunkParserI',..........

Categories

Resources