ModuleNotFoundError: No module named 'docxtpl' - python

I know that this is a simple question...I have tried going through a few of the other questions related to ModuleNotFoundError w/Pycharm and I tried uninstalling docxptl via pip but to no avail.
Looking in the library i see docxtpl so I am a bit confused.
I also uninstalled and reinstalled lxml via pip as that seemed to cause some issues with docxptl with other people with docxtpl
code:
from docxtpl import DocxTemplate
error message:
ModuleNotFoundError: No module named 'docxtpl'

Follow my steps carefully:
Go to PyCharm settings
Search for Project Intrepreter
Click on the + icon in the window
Then search for docxtpl in the new window and then click on it
Then select Install Package
Full fledged tutorial here: https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html

Related

ModuleNotFoundError: No module named 'google'

I am new to PyCharm (coming from RStudio world). I am just trying to setup a PyCharm project. My first line of code is google library import (Later I intend to write codes for pulling data from BigQuery).
But I am getting an error saying ModuleNotFoundError: No module named 'google' in PyCharm. I tried suggested solutions for a very similar stackoverflow question.
I also tried invalidating cache and restart by doing File >
I can see that the google is installed in the Python interpreter. I am not able to figure out what's the issue. To me looks like it is related to the way we setup environment in PyCharm.
Edit: I checked Project interpreter and Run Configuration interpreter. Both match and still get the same thing.
The library you want to use is not named google, is called google-cloud-bigquery, just install that one.
Look here:
https://cloud.google.com/python/docs/reference/bigquery/latest#windows
I guess you know, but you can install it with pip (like in the above link) or in Pycharm settings (clicking in the + in your third screenshot).

Python 3 How to resolve No module named '_win32com' error?

I'm using Python 3 and working in Pycharm.
I was able to get pywin32 and win32com working on one project, but since I have tried importing them into a new project, they don't seem to be working. At first I was getting No module named 'win32api', but I updated the win32com\__init__.py from import win32api to from win32 import win32api. That seems to have fixed the initial error, but now I'm getting No module named '_win32com'. This seems to be from issues with \pythoncom\__init__.py maybe?
I've tried uninstalling and reinstalling pywin32 and pypiwin32 as well.
Example of code here:
import win32com.client as win32
xlapp = win32.DispatchEx("Excel.Application")
wbe = xlapp.workbooks.open(r"C:\Users\me\example.xlsx")
I decided to try again with a new project and install the packages globally and that has fixed the issue. Still not sure why it wasn't working when installing locally, but using global installs seems to be good solution.

No module named 'oauth2_provider.ext'

i'm having this error could someone help me with it.
File "/Users/king/Desktop/dash1-env/DASH/lib/python3.7/site-packages/rest_framework_social_oauth2/views.py", line 7, in
from oauth2_provider.ext.rest_framework import OAuth2Authentication
ModuleNotFoundError: No module named 'oauth2_provider.ext'
I was facing the same error.
Here is the solution:
pip install django-rest-framework-social-oauth2
instead of:
django-rest-framework-social-oauth2==1.0.4
...this version caused the error
(I'm guessing outh2_provider.ext is a module)
The ModuleNotFoundError comes if you did not properly download the module, not download it at all, or mistyped it.
Go to the terminal inside of your script editor or IDE
to download with python 3 and above:
pip3 install OAuth2 Provider
to download with python 2:
pip install OAuth2 Provider
It should download and the at the top instead of import oauth2_provider.ext you write:
import oauth2

Python - Package installed into site-packages but won't import

I have installed the package xlrd but am unable to import it when using my IDE (Rodeo).
Having looked at a few questions on stackoverflow, I still can't work out why I get the following error:
ImportError: No module named 'xlrd'
The xlrd folder in site-packages does have an __init__.py file.
Additionally, if I attempt to import xlrd using the Command Prompt, I get no errors. But I do when using Rodeo.
While trying to solve this problem, I have added the file location of site-packages (C:\Users\HP\AppData\Local\Programs\Python\Python36-32\Lib\site-packages) to the System Variables "Path", although I'm not sure what this does or if it's relevant.
I am using Python 3.6 and am a Python beginner so would appreciate any answers to be described in a basic way!

Python refuses to recognize library I am almost certain exists

I have no idea why this is so frustrating, but I have literally pulled out a few clumps of hair in rage because this just refuses to work and I honestly do not have the slighest clue on what to do. I am trying to use the winshell module for a quick python programming I am using. I am new to python and just started trying it today. I have tried to install the library manually, and through pip. pip claims the module is downloaded, and I can see it in the lib folder. No matter what I do I get this error when I try to run my code:
import winshell
ModuleNotFoundError: No module named 'winshell'
what on earth must I do to get this to work I am at my wits end here and I feel like I'm going to break something
You have to install the library with:
pip install winshell
I just tested with pip3 install winshell and it worked.
Python interpreter search for modules in the set of directories that you can see with:
import sys
print(sys.path)
I recommend you take a look to see if the directory where you are seeing the library in lib is include in that list.
Might be useful to you read: The Module Search Path

Categories

Resources