I am trying to use openpyxl with python 3.7, but when starting my .py file in my windows shell I got the ModuleNotFoundError.
It is kinda weird as i don't get this error if I write my code in the python interpreter (can create and save .xlsx files)
I tried uninstalling and installing again via pip3 and/or running shell as admin (pip is updated).
I don't use many other modules (os, wx, csv and calendar) so it shouldn't interfere.
I renamed my .py file so i'm sure there is no name conflict.
import openpyxl
#from openpyxl import Workbook (doesn't work either)
Do you have an idea where this may coming from ?
regards,
Clem
I think I found a solution, as I don't get the error anymore.
I added the encoding and language interpreter at the beginning of my .py file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from openpyxl import Workbook
Hope it helps :)
Am trying to install utilities module for both python and anaconda environment.I have python 3 in my Mac.Here is the error I get.
pip install utilities
Could not find a version that satisfies the requirement utilities (from versions: )
No matching distribution found for utilities
Please help :(
If you are trying the ML example from here, then please copy the utilities.py from chapter 2 in your python 3 in Lib directory and you will be able to use the utility module.
Please try the below:
pip install data-utilities
You can find more on the Python Package Index - data-utilities website.
There is no module named utilities in Python,I believe you have encountered importing a file called utilities.py by the line import utilities. Showing the full source code might help. Additionally, check the gitgub repo of your source code for a file called utilities.py and copy it to your execution folder. If you are talking about python-utils, check this link.
Python Utilities contains many standard utility modules to solve common problems. They are :
File System -- os, os.path, shutil
Running External Processes -- commands
Exceptions
HTTP -- urllib and urlparse
Check This link
If this doesn't solve your issue, try installing the utilities-package using :
pip install utilities-package
I am running Python 3.5.1 and PyInstaller 3.2 on Windows.
I need to compile my script into an exe. I have done this with pyintaller before with different scripts and have had no issues. Pyinstaller is having trouble importing xlrd. I have tried:
--hidden-import=xlrd
and also
--hidden-import xlrd and neither has worked.
I have heard about hooks but I cannot find any documentation on how to set up the hook-xlrd.py file.
I have been getting the error:
ImportError: No Module called xlwt
The script runs perfectly from the Command Prompt.
Somehow, your application requires xlwt. So do a pip install xlwt and then add --hidden-import=xlwt to your arguments. For a more comprehensive guide, see here.
I am using python 3.4 on windows 7. In order to open a doc file I am using this code:
import sys
import win32com.client as win32
word = win32.Dispatch("Word.Application")
word.Visible = 0
word.Documents.Open("MyDocument")
doc = word.ActiveDocument
I'M not sure why is this error popping up every time:
ImportError: no module named win32api
Although I have installed pywin32 from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32
and I have also checked the path from where I am importing. I have tried reinstalling pywin32 as well but that doesn't remove the error.
Try to install pywin32 from here :
http://sourceforge.net/projects/pywin32/files/pywin32/
depends on you operation system and the python version that you are using. Normally 32bit version should works on both 32 and 64 bit OS.
EDIT: moved to https://github.com/mhammond/pywin32/releases
This is a bug in the library itself, probably they used a different python implementation for creating this.
What they are trying to import is the site-packages\win32\win32api.pyd file, but the win32 folder is not in the path that python searches in, but site-packages is.
Try to replace the import win32api (inside win32com\__init__.py) to from win32 import win32api
I encountered the same error yestoday with Python 3.6.1 on Windows 7, and resolved it by "pip install pypiwin32".
Had the same error trying to import win32com.client (using Python 2.7, 64-bit). I agree with TulkinRB, there seem to be path issues, but the fix suggested did not work for me, since I also could not import win32.
Perhaps my fix will also work in Python 3.4.
Eventually, installing the .exe from SourceForge as an administrator (as suggested in Rina Rivera's answer here) allowed me to import win32com.client from IDLE, but not when I executed the script I was originally trying to run.
In the end, I discovered 3 differences in the sys.path that had been extended when I installed as admin and opened IDLE, but were not applied when executing a script. By extending the sys.path in my script, I was able to get rid of the import errors when I executed it:
import sys
sys.path.extend(('C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin'))
Finally, if you want more than a temporary fix, the sys.path could be permanently extended by establishing IDLESTARTUP or PYTHONSTARTUP variables (as described here and here).
You can create the __init.py file inside the win32 folder and then go inside the win32com folder and change its __init__.py file, where it is import win32api, change to from win32 import win32api
I ended up debugging and copying and pasting the necessary files into the appropriate folders. It's a work-around until the bug is fixed, but it works.
from https://github.com/mhammond/pywin32/issues/1151#issuecomment-360669440
append the 'pypiwin32_system32' path to your system PATH,
in a script this can be done like:
import os
sitedir='C:/where_ever/'
os.environ["PATH"]+=(';'+os.path.join(sitedir,"pypiwin32_system32"))
...
from powershell
$env:PATH="$PATH;C:\where_ever\pywin32_system32";
python.exe ...
for help on site dir, see What is python's site-packages directory?
Are there any python3 modules for importing(reading) excel .xls files or is there any work in progress on porting one of the python2 modules? All I'm coming up with is xlrd for python2.
I believe the maintainer of xlrd is working on porting it, but it's not yet ready.