I have installed the 64 bit version of the Anaconda python distribution on my Windows 64 bit machine. I am trying to cythonize a python script and I get an error at the following line:
from disutils.core import setup
ImportError: No module named disutils.core
I tried
import disutils
ImportError: No module named disutils
Based on the information at the following link :
https://pypi.python.org/pypi/setuptools#windows-7-or-graphical-install
I downloaded and ran ez_setup.py
I still get the same error. Can anyone help me solve my problem ?
from disutils.core import setup
should be:
from distutils.core import setup
You have spelled it disutils and distuils both missing a t
import distuils should be distutils
Related
I keep getting the same error of aws-cdk not being able to run on the code. I first thought it was case sensitivity but that did not solve the issue. I think it may be a path location issue but I have already done the installs through npm and the pip install of the requirements txt. I'm not sure what I am doing wrong.
Code:
#!/usr/bin/env python3
import os
from aws_cdk import core as cdk
Terminal:
File "C:\Users\aliai\Desktop\rekognition-video-people-blurring-cdk-main\my-project\app.py", line 4, in
import aws_cdk as cdk
ModuleNotFoundError: No module named 'aws_cdk'
You should install aws_cdk module via pip, according to docs:
https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-python.html
I'm using python 3.6 and attempting to import win32com.client as win32 to be able to send an email with outlook but keep getting the above import error.
I've installed both pywin32 and pypiwin32 and run the postinstall script (did see it say "You do not have the permissions to install COM objects.)
I see the pywintpyes36.dll and pyhoncom36.dll in the location I'm running the script out of.
I've done a bit of searching and can't seem to find what I'm missing. Is it the fact that I was unable to install the COM objects? Any help would be greatly appreciated, thanks.
[EDIT]
I'm working out of a venv, and have installed both libraries using py -m pip install pywin32 and py -m install pypiwin32. I verified that I see the installation in the "site-packages" folder within my venv.
my imports:
import sys
sys.path.append("C:\path\venv\Lib\site-packages")
import tkinter as tk
import getpass
import os.path
import time
import os
import win32com.client as win32
import sqlite3
from datetime import datetime
from functools import partial
I have the sys.path.append there otherwise the module is not found at all.
Full error message:
Traceback (most recent call last):
File "C:\path\program.py", line 8, in <module>
import win32com.client as win32
File "C:\path\venv\Lib\site-packages\win32com\__init__.py", line 5, in <module>
from win32 import win32api
ImportError: DLL load failed: The specified module could not be found.
This may not be directly relevant for the OP, but may be of help to others who end up here based on the title.
Summary
Possible workaround for conda environments with Python>=3.8:
DO NOT pip install pywin32, but
DO conda install pywin32 (e.g. from conda-forge)
Details
I encountered the following error in a freshly created (Mini-)Conda environment with Python 3.9 on windows 10, after installing pywin32 via pip:
ImportError: DLL load failed while importing win32file: The specified module could not be found.
The pywin32 installation instructions mention this type of issue explicitly, and there are several related issues.
However, in my case something else was going on.
Here are some interesting observations:
I have numerous other, pre-existing, conda environments, with python versions ranging from 2.7 to 3.8, and corresponding pywin32 versions, in which the issue does not arise (just verified this).
All these environments have their own pywintypesXX.dll etc. yet they coexist peacefully.
There is no pywintypesXX.dll in my system32 folder.
I have never needed to run the pywin32_postinstall script, yet.
As it turns out, on my system, the import error only arises if I do a pip install pywin32 in a conda environment with Python>=3.8. The issue does not arise for Python 3.7 (nor for 2.7).
In a Python>=3.8 conda environment, conda install pywin32 fixed the issue (instead of using pip).
Apparently Python 3.8 changed the way dll files are found. This change has been incorporated in pywin32, but can still cause trouble if you mix conda and pip.
Related:
DLL load failed: The specified procedure could not be found. win32api, sys, os
How to fix "ImportError: DLL load failed" while importing win32api
How to fix 'DLL load failed while importing win32api' in Jupyter notebook after connecting VS code to Jupyter notebook?
I wrote the following python line import scipy.io then I went to that folder's location in the cmd:
C:\Users\me\PycharmProjects\test>
and typed pip install scipy apparently it installed the dependencies then I went back to pycharm, ran my code and got error
ModuleNotFoundError: No module named 'scipy'
I'm just starting off with python I'm on windows 10.
PyCharm has a GUI for managing which python installation you use and packages installed:
https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html
I have installed vtk through the conda-forge channel. But get the below error upon importing vtk.
ImportError: No module named vtkRenderingOpenGLPython
Following this SO I added the path of my vtk package to PYTHONPATH. Including the path to the vtk-7.0.0-py27_2/lib where I see libvtkRenderingOpenGL-7.0.so
But no luck, import still does not find it. Any suggestions on what I am doing wrong are appreciated.
I'm trying use py2exe on a program that imports urlparse from six.moves.urllib_parse. Here is the program:
# hello.py
from six.moves.urllib_parse import urlparse
print('hello world')
And here is my setup.py:
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
Running hello.py works fine. When I compile hello.py into an exe using python setup.py py2exe, a hello.exe file is produced. However, when I run hello.exe I get an error saying:
ImportError: No module named urlparse
I'm using Python 2.7.
With Python 3.4, I get an error saying KeyError: 'six.moves' when running python setup.py py2exe.
How can I stop these errors from occurring?
The problem is just that py2exe doesn't detect the modules that are proxied through six, so they're not bundled.
All you have to do is add the module in question (urlparse) to your includes in your setup.py:
options={
"py2exe": {
...
"includes": ["urlparse"],
...
That way the module will be packaged, and when six tries to import it, it will work.
py2exe released a new version recently that fixes this problem:
Changes in version 0.9.2.2:
- Added support for six, cffi, pycparser, openssl.
Using this version I was able to create an .exe and run it successfully.