Python wkhtmltopdf can't import module - python

I am using Python version 3.6, Django version 1.9 and wkhtmltopdf version 0.2. My Python is not GCC it's Anaconda3.
When running my project which uses wkhtmltopdf, following error will be thrown:
from main import WKhtmlToPdf, wkhtmltopd
ModuleNotFoundError: No module named 'main'
This is how I imported the wkhtmltopdf:
import pdfkit
from wkhtmltopdf.views import PDFTemplateView

Yes i got the answer. This error occurred because i didn't installed django-wkhtmltopdf.
installed >> `pip install django-wkhtmltopdf
I hope this answer will help to resolve the similar error.

after installing pdfkit with following command and pointing python version 3.8, i was able to get pdfkit working on mac
pip3 install pdfkit

Related

Pycharm not finding module installed (dnspython) in venv [duplicate]

I want to check MX-Record from Python. So I installed the dnspython package, but when I try to import following library:
import dns.resolver
It shows the following error:
ModuleNotFoundError: No module named 'dns'.
I use PyCharm and Python 3.
You should install https://github.com/rthalley/dnspython first
pip install dnspython

ImportError: cannot import name 'parse_dict' from 'psqlparse'

I am trying to import parse_dict from by psqlparse:
from psqlparse import parse_dict
Then there is an error below that I cannot seem to find mentioned by anyone on the internet. Does anyone have an idea? Thank you! I am using Python 3.8.5 on Ubuntu 20.04
The error is:
ImportError: cannot import name 'parse_dict' from 'psqlparse' (/home/name/.local/lib/python3.8/site-packages/psqlparse/__init__.py)
It seems there are two versions of psqlparse - default but old 0.2.5 and unofficial (Release Candidate) but the newest 1.0.rc7. Old version doesn't have parse_dict but new one has it.
You can (re)install it with
pip install -U psqlparse==1.0rc7
BTW:
If you try to install wrong version - ie. pip install psqlparse==hello - then it displays error message with all avaliable versions and you can see which version you can install.

AttributeError while loading textHero library

I am getting an error when importing textHero
#import the texthero library
import texthero as hero
import pandas as pd
Error : AttributeError: module 'nltk' has no attribute 'data'
I have installed textHero again but error did not get resolved.
Can you please post the whole error message?
Anyway, you should be able to solve the problem by uninstalling and installing again NLTK:
pip uninstall nltk
pip install -U nltk
Specify the gensim version to 3.8. worked for me
After importing the "texthero" library. It showed an error message:
ModuleNotFoundError: No module named 'gensim.sklearn_api'
I have tried to install 'gensim.sklearn_api', but no such module available yet.
Also, created the new anaconda environment for an older version of python-like 3.6 and 3.7 but It showed the same error message.
I have installed the older version of texthero and its work
pip install texthero==1.0.5
The older version of texthero==1.0.5 is very much compatible with python version like 3.6, 3.7 and 3.8
[![enter image description here][2]][2]

ModuleNotFoundError: No module named 'camelot'

I want to extract tables from pdf and for that
I used Camelot. But I'm getting this error whenever I try to import it:
import camelot
Traceback (most recent call last):
File "<ipython-input-11-679d8f55abf0>", line 1, in <module>
import camelot
ModuleNotFoundError: No module named 'camelot'
I've tried installing camelot using:
pip install camelot-py[cv]
and
pip install camelot-py[all]
but I'm getting the same error again and again. How do I remove this?
Your help would be appreciated!
Check for your python version by writing python --version in the command prompt with the path where python is installed.
For python 3.7, try:
pip install camelot-py
https://pypi.org/project/camelot-py/
I hope this works for you.
If using conda (this is what I'd recommend):
conda install -c conda-forge camelot-py
If using pip (may have to manually handle dependencies): pip install camelot-py[cv]
Official installation instructions: https://camelot-py.readthedocs.io/en/master/user/install.html#install
Try to install Camelot in correct python version directory using
''''python2.7 -m pip install''''
Use your python version number instead of 2.7 above
In your python environment you have to install padas library.
You can install Camelot python with following command:
pip install Camelot
After the installation of Camelot python library, ModuleNotFoundError: No module named 'Camelot' error will be solved.
Thanks

I am still getting the error ImportError: No module named requests after installing requests using pip3

I am using Python 3.6.5 in Visual Studio Code on a Mac.
I installed pip3 and it is up to date, when I put in the command :
$ pip --version
I get this result :
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
I imported the module requests.
And when I put in this command :
pip freeze | grep requests
I get this result :
requests==2.19.1
So I thought this meant the requests module was installed, but I still get the error ImportError: No module named requests when I put in : import requests in my file and try to run it.
Can somebody explain what is happening? Thank you :)
I found the answer, turns out I was using an extension called Code Runner and I thought it used the integrated terminal, where I had configured Python3. But turns out it uses its own interpreter. I added the following to my user settings:
"code-runner.executorMap": {
"python": "python3",
}
and now it works! :)

Categories

Resources