importing module using pip - python

I want to import a module called BaselineRemoval using pip, however, after installing it, python (version 3.8) is giving error of :
ModuleNotFoundError: No module named 'BaselineRemoval'
I am not familiar with dealing with these kinds of things, so any help with this?

Check you writed everythong right;
pip: pip install BaselineRemoval
python: from BaselineRemoval import BaselineRemoval
Here is the documentation for more questions you may have.

Related

I installed the pandas package and I'm still getting the same error: No module named 'pandas'

input:
import pandas
output:
ModuleNotFoundError: No module named 'pandas'
I installed the package with the command line - pip3 install pandas,
my python version is 3.10.7
The source of the installed panda package: c:\users\kfirs\appdata\local\programs\python\python310\lib\site-packages
not sure if this will help but in the command prompt type pip --version check to make sure you're on a version that is fluent with pandas, don't know much about pandas but I assume you should try and do the same with pandas. My knowledge is limited but try installing on the same drive as python as this could possibly be why things are not working. 3rd sometimes I have issues with windows after installing pip packs so try restarting your pc sometimes my imports right after installing don't work and this usually fixes but only if it's truly installed where it needs to be and the version needed. Hope I could help.

Issues with vartest package - Python

I tried to install the vartests package in Python with the following command:
pip install vartests
and, by using pip list, it shows that the package is installed.
However, by importing the module I receive the following error message:
import vartests
ModuleNotFoundError: No module named 'vartests'
Do you know why it's not working?
Many thanks

Failed to install scitools-iris using pip: ImportError No module named target_pkg (in pyke)

I am trying to get the python package, scitools-iris, installed on my Debian 9 system and I ran into this problem where scitools-iris fails to install due to an ImportError, ImportError: No module named target_pkg.
I am using python 2.7 and all packages are installed using pip only. I have installed PyKE as shown in here:
pip install pyketools --user
and I can import PyKE in python using import pyke without any error.
Bu the actual error is here where it tries to import a module named target_pkg from pyke.target_pkg. I tried the import statement in python,
from pyke.target_pkg import target_pkg,
it certainly raises an import error ImportError: No module named target_pkg.
How do I get around this problem and install iris in my system?
Have I installed the wrong package for PyKE?
Found out what I have been doing wrong. I actually had the wrong package installed for PyKE using pip. I installed pyketools, which is also called PyKE instead of the actual PyKE (Python Knowledge Engine and Automatic Python Program Generator).
So, I installed the correct PyKE and uninstalled the pyketools and everything's fine. Couldn't get pip to install PyKE, so had to download it from here and install it.

Importing universe

I am trying to use OpenAI and I got a import error about universe on Jupyter notebook :
import gym
import universe
No module named 'universe'
When it comes to working on terminal, it returns this error
No module named 'twisted.internet'
Then I also had install twisted with pip, I got this next error :
No module named 'ujson'
and after install ujson, I got a error No module named 'go_vncdriver' again.
I think that I will get other error again.
So which way to install is most convenient ?
Could I install all packages at once ?
préferably, using pip install.
I am using OSX and python3.6.
Try installing,
pip install go_vncdriver
And check again.

When import docx in python3.3 I have error ImportError: No module named 'exceptions'

when I import docx I have this error:
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/docx-0.2.4-py3.3.egg/docx.py", line 30, in <module>
from exceptions import PendingDeprecationWarning
ImportError: No module named 'exceptions'
How to fix this error (python3.3, docx 0.2.4)?
If you are using python 3x don't do pip install docx instead go for
pip install python-docx
It is compatible with python 3.x
Official Documentation available here: https://pypi.org/project/python-docx/
When want to use import docx, be sure to install python-docx, not docx.You can install the module by running pip install python-docx.
The installation name docx is for a different module
However,
when you are going to import the python-docx module,
you’ll need to run
import docx, not import python-docx.
if still you want to use docx module then:
First of all, you will need to make sure that the docx module is installed.
If not then simply run pip install docx.
If it shows '*requirement already satisfied*'
then the solution is :
Go to the library to find docx.py file,
you'll need to go to directory where you installed python then \Lib\site-packages\ and find docx.py file
Open docx.py file in text editor and find this code
from exceptions import PendingDeprecationWarning
Replace the above code with
try:
from exceptions import PendingDeprecationWarning
except ImportError:
pass
Save the file
Now you can run import docx module in Python 3.x without any problem
Uninstall docx module with pip uninstall docx
Download python_docx-0.8.6-py2.py3-none-any.whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/
Run pip install python_docx-0.8.6-py2.py3-none-any.whl to reinstall docx.
This solved the above import error smoothly for me.
If you're using python 3.x, Make sure you have both python-docx & docx installed.
Installing python-docx :
pip install python-docx
Installing docx :
pip install docx
You may be install docx, not python-docx
You can see this for install python-docx
http://python-docx.readthedocs.io/en/latest/user/install.html#install
In Python 3 exceptions module was removed and all standard exceptions were moved to builtin module. Thus meaning that there is no more need to do explicit import of any standard exceptions.
copied from
pip install python-docx
this worked for me, try installing with admin mode
The problem, as was noted previously in comments, is the docx module was not compatible with Python 3. It was fixed in this pull-request on github: https://github.com/mikemaccana/python-docx/pull/67
Since the exception is now built-in, the solution is to not import it.
docx.py
## -27,7 +27,12 ##
except ImportError:
TAGS = {}
-from exceptions import PendingDeprecationWarning
+# Handle PendingDeprecationWarning causing an ImportError if using Python 3
+try:
+ from exceptions import PendingDeprecationWarning
+except ImportError:
+ pass
+
from warnings import warn
import logging
I had the same problem, but pip install python-docx worked for me, I'm using python 3.7.1
You need to make it work with python3.
sudo pip3 install python-docx
This installation worked for me in Python3 without any further additions.
python3
>> import docx
PS: Note that the 'pip install python-docx' or apt-get python3-docx are not useful.
I had the same problem, after installing docx module, got a bunch of errors regarding docx, .oxml and lxml...seems that for my case the package was installed in this folder:
C:\Program Files\Python3.7\Lib\site-packages
and I moved it one step back, to:
C:\Program Files\Python3.7\Lib
and this solved the issue.
Had faced similar issue and found a work around have posted answer aswell under similar question find its link :https://stackoverflow.com/a/74609166/17385292
python imports exceptions module by itself
comment out import line. it worked for me.

Categories