No module named win32console, while running wexpect - python

I want to run wexpect (the windows port of pexpect) on my Windows 7 64-bit machine. I am getting the following error:
C:\Program Files (x86)\wexpect\build\lib>wexpect.py
Traceback (most recent call last):
File "C:\Program Files (x86)\wexpect\build\lib\wexpect.py", line 97, in <module>
raise ImportError(str(e) + "This package was intended for Windows like operating systems.")
ImportError: No module named win32console This package requires the win32 python packages.This package was intended for Windows like operatin
g systems.
In the code it is failing on the following line:
from win32console import *
I am using Python 2.6.4. I cannot figure out how to install win32console.

Install this: http://sourceforge.net/projects/pywin32/
Edit to add slightly longer explanation: There's a very useful set of Windows-specific Python modules, called PyWin32. I believe win32console is part of that. You can either install PyWin32 on top of the standard python.org release of Python, or you can install ActiveState ActivePython which bundles everything you need all together. I'm using ActivePython and I have a win32console module.

Install wexpect with pip to install all dependencies (inluding pywin32).
pip install wexpect

Related

pywin32 ImportError: DLL load failed: The specified module could not be found

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?

ImportError: No module named configobj

I created .exe file using pyinstaller 3.3.1 and I got this message
Traceback (most recent call last):
File "install.py", line 14, in <module>
ImportError: No module named configobj
[8468] Failed to execute script install
I'm working with python 2.7 using conda environment. Lately I had updated pyinstaller to version 3.3.1 so this happened to me while I'm checking that the update is safe.
I have also created another .exe file from different script that uses also this import and its went well, so any help will be welcome.
I got this error from certbot on Ubuntu 20.04 (focal). On this version of Ubuntu, python 2 seems to be mostly deprecated and many things don't work when using it. Everything needs to be configured to use python3.
When I ran certbot, it was still using python 2.
File "/usr/local/lib/python2.7/dist-packages/certbot/main.py", line 9, in <module>
import configobj
ImportError: No module named configobj
Python 2 pip is no longer available from apt on this version of Ubuntu, so I was not able to install the proper libraries for python 2 using pip.
The version of certbot in apt is supposed to be for python3. (python3-certbot). The executable for certbot gets installed at /usr/bin/certbot.
After further investigating, I found that I had an older python 2 version of certbot hanging around at /usr/local/bin/certbot. Once I removed that (sudo rm /usr/local/bin/certbot), the python3 version of certbot runs just fine and is able to find all its libraries.
You need to install configobj via pip apt install python-pip

Not able to import Python packages

Not able to install any packages
I've tried VLC package from https://wiki.videolan.org/python_bindings
and got a traceback.
Now I am trying pygame module and this is what i get
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pygame
File "C:\Users\Vineeth\AppData\Local\Programs\Python\Python36-32\lib\pygame\__init__.py", line 133, in <module>
from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.
Please help i am pretty new to python
There are some release binaries for Python3.x, 64bit Windows at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
I suggest you download it from that site and install it. It works for me. If you are using Windows ,it is a good way to install some packages,like lxml matplotlib.
Also you check out this question.
Hope this helps.
I tried to execute your statements and the imports worked fine for me. I have a 64bit Windows OS. And my python version Python 3.5.2 - 64bit.
Check if you have other Python versions, if you have removed them, make sure you did that right.
Ultimately I would just suggest you to do pip install pygame. The version compatibility will be handled by pip itself.

Django Taggit Module Installation Error: No module named setup tools

The title basically explains it all.
I am running Windows 8 (windows 7 was previously installed... If it helps with answering) and am using Python 2.7.
Upon using the code:
python setup.py install
I am getting this error:
C:\Users\Nicholas\Desktop\taggit>python setup.py install
Traceback (most recent call last):
File "setup.py", line 52, in
from setuptools import setup
ImportError: No module named setuptools
Any help?
Thanks in advance
Nicholas
You need to install setuptools, which allows packages to be configured for your Python installation. It is not included with the default Python installer.
From this link you can download Windows installers for many Python packages (I have linked it directly to setuptools). Make sure you download the version that matches your Python installation.
in Python 3:
pip3 install setuptools
And in Python 2.x:
pip install setuptools

Graphics folder modules will not import after several installs (Mac OSX)

A similar problem with the python gdal module Gdal will not import after several installs (Mac OSX) was solved by modifying my shell profile to ensure MacPorts-installed ports are found, and then using sudo port select python python27.
But this time it's every module in my graphics folder that deals with tiff and png reading and writing that will not import:
tiff #3.9.5 graphics/tiff
pngpp #0.2.3 graphics/pngpp
libgeotiff #1.3.0 graphics/libgeotiff
Again, when I run python to import either module I get the similar response:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named png
What am I doing wrong?
For most Python packages, MacPorts has separate ports available for each supported Python version. For example, if you are trying to use PIL (the Python Imaging Library), you need to install the 2.7 version of that port:
sudo port install py27-pil
That will also install the MacPorts version of Python 2.7, if you don't already have it installed. It is located at /opt/local/bin/python2.7.

Categories