ModuleNotFoundError: No module named 'html2text' - python

I am runnig a python based application (Odoo) on Ubuntu Server, it is throwing this error in the backend server logs. Some sites suggested to install the missing packages/library html2text.
I have installed that too by running
pip3 install html2text
and verified it by
pip3 show html2text
which shows location of site-packages of python
Location: /home/dell/.local/lib/python3.8/site-packages.
However, the system is still throwing this mentioned error in the logs ModuleNotFoundError: No module named 'html2text' - - -.
Is there anything I am missing related to path or installation steps?

I figured it out myself. The problem was with default python package path installation. Since my application was looking for python packages at this location /usr/lib/python/dist-packages and the package html2text was installed in /home/dell/.local/lib/python3.8/site-packages
I had to install the html2text package in /usr/lib/python/dist-packages by running
sudo pip3 install --target=/usr/lib/python3/dist-packages html2text

Related

Weird error of ModuleNotFoundError: No module named 'tqdm' when run pip install -e but works when using python setup install

when I git clone this github repo, I am able to install it via python setup.py install. However, the installation fails if tries to use pip install -e . with an error:
ModuleNotFoundError: No module named 'tqdm'
I looked up this issue and ensured tqdm has been installed in the environment.
I also noticed that travis service for this package cannot also pass its build and having the same error regarding tqdm: https://travis-ci.com/github/aristoteleo/dynamo-release/jobs/367588183
see [screenshot of the error message][1]
I managed to fix this issue. The culprit is simply because you cannot specify specific version of tqdm in your setup.py file. Meanwhile, the specification of package requirement between the pyproject.toml and the setup.py need to match up.

pip list shows installed module but still getting import error

I am working with python flask's requests module. I have installed requests module using :
pip install requests
And verified that requests module exists when I run :
pip list
But when I run my python application , I receive import Error for requests module.
I noticed that pip is installing the module in C:\Users\xx\Documents\Projects\Python\Python3REST\lib\site-packages\ folder BUT the interpreter is looking for the module in C:\Users\xx\Documents\Projects\Python\Python3REST\lib\site-packages\flask\ folder.
I have tried running the command :
pip install --install-option="Path to install in" requests
But threw some other error.
The import error I am getting states :
ImportError: cannot import name 'requests' from 'flask'
(C:\Users\xx\Documents\Projects\Python\Python3REST\lib\site-packages\flask\__init__.py)
I am working in virtualenv in Windows 10.
I recently had the same problem installing a self made package. I installed it with pip install <package> and checked it was actually installed with pip list but running the script with import <package> returned a ModuleNotFoundError: No module named <package>.
I solved the problem creating an empty file called __init__.py in the package directory.
Check https://pythontips.com/2013/07/28/what-is-init-py/ and https://docs.python.org/3/tutorial/modules.html#packages for better understanding.
what if you add that folder to your path? using sys.path.extend?
I solved it using python3 -m pip install <package name>. In the OP's case, it should be python3 -m pip install requests.
Note that I'm using python 3.10.

Trying to install a pack from source. I get: ImportError: No module named requests Yet the pack is installed

I'm trying to install: https://github.com/rozzac90/pinnacle.git from source.
If I type sudo python setup.py install (or sudo python setup.py configure) I get:
import requests
ImportError: No module named requests
The module is installed, I'm sure. It is in the list of conda installed packs. Also, if I try to import it in other scripts, and
python
>>> import requests
>>>
with both python 2 and python3. I get no errors.
I also removed it and installed it again. Same results.
I am using Anaconda with a python3 environment. (I get the same errors in python 2, though.) So I can't use pip commands. I'm running a lubuntu machine, latest version.
Ideas anyone? Thanks in advance !
A suggested answer :
The solution was to run the script in the folder where setup.py is located, in general :
Try with
sudo /[annaconda_python_path]/python setup.py install
Make sure the right environment is active in the terminal.

ModuleNotFoundError: No module named 'requests'

I have installed the pip3 as well as requests package in my pc.Even then on running the command import requests on my shell,i am getting the following error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
I have to manually copy all the packages to my working directory to tackle this exception.
Find were your python is installed and find Scripts directory. Open cmd, go to this folder and type pip install requests.
For me it was like below:
cd C:\Users\myLocalUserName\AppData\Local\Programs\Python\Python36\Scripts
pip install requests
In PyCharm you should:
Go back to base configuration in "File" - "Settings" - "Python Interpreteter" (it is the path that ends with "...\python.exe")
Click on the plus and install this module by typing name in search field.
Choose this configuration and run it by pressing Ctrl+Alt+F10
For listing instaled modules for Python 3:
sudo pip3 list
For installing the request module for Python 3:
sudo pip3 install requests
Make sure that requestes module should have version starts with 2
Not correct
pip3 list
Package Version
requestes 0.0.1
I installed this and installed using
python -m pip install requests
Later :
PS C:\python\Scripts> pip list
Package Version
certifi 2021.5.30
chardet 4.0.0
idna 2.10
pip 21.1.3
requests 2.25.1
urllib3 1.26.6
Activate Virtual Environment
.\env\Scripts\activate
Install the dependencies,
pip install request
Been tackling this issue for 2 hours now, this solution did it!
Find your Python installation location and, specifically, the Scripts directory. Open cmd, and run the following:
cd C:\Users\<myLocalUserName>\AppData\Local\Programs\Python\Python36\Scripts
pip install requests
For me, I used the package manager within my IDE (Pycharm in this case) to see if 'request' was installed. Once I did that, then the error went away.
I also tried pip install, but I suspect I have multiple python on the system and pip didn't install to the correct python. This is why others are suggesting to install from a specific python installation.
In Linux or Mac, you can run 'which python' for additional clues.

Python - ImportError: No module named 'requests'

I get this error when running code, so it appears that requests hasn't installed properly. I am running Windows 7 32-bit system with Python 3.3.
When I go into 'Programs and Features' in windows it shows up as installed.
I installed this program from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and I have also downloaded the requests folder and tried installing it this way, I can't seem to get this to work.
I have visited ImportError: No module named 'requests' already, but I didn't find this helped at all.
I keep seeing the following statement, but I am uncertain of how to run this?
$ python setup.py install
Please help!?!
The answer there is clear. But let me explain to you as good as I can. This error comes because requests module is not installed in your system
Download the requests module to your system from here
And extract it. Go to your command prompt/terminal and reach to the folder you downloaded.There, you will see setup.py, the file that you need to execute to install the requests module.
python setup.py install
Installs the requests module
This line:
$ python setup.py install
It's a command line in a terminal in Linux or the alike. My guess is that you could do the same opening a terminal in Windows pressing the start key and typing 'cmd', without quotes of course. If you had python already install the %PATH% variable should be set up properly and it should just run. Well, perhaps you need to go to the same folder as the setup.py using
> cd path_to_file
And then,
> python setup.py install
I hope it helps. Let me know otherwise.
If you are using Ubuntu, there is need to install requests
run this command:
pip install requests
if you face permission denied error, use sudo before command:
sudo pip install requests

Categories

Resources