I am getting the error 'ModuleNotFoundError: No module named 'win32gui''. Please brief me the instructions on how can I resolve this issue on my anaconda on mac.
You must install it from the version hosted on the pip package manager. You can do this with the following command:
pip install win32gui
import nmap
ModuleNotFoundError: No module named 'nmap'
the above is the result when trying to run the code after importing nmap. (I have installed python-nmap using pip in cmd)
i found out the issue. when i chose a python env eg- python 3.8 32bit from the IDE, i chose a custom version thats why the imports dont work. when i chose the default env it worked. anyways thank for the help. there is nothing wrong with the IDE
I had to do two things to get it working:
Install the latest version of Python3 (3.9.6) https://www.python.org/downloads/release/python-396/
On your terminal:
pip3 install python-nmap
I had to do the following to get things to work:
On your terminal, switch to root privilege:
su - root
Then, install python-nmap module:
pip3 install python-nmap
Reference: https://github.com/securipy/nmap-scan/issues/26
STEP 1:
Uninstall the package using:
pip3 uninstall python-nmap
STEP 2:
Install the package:
pip3 install --user python-nmap
I have installed a package named hypixel for my discord bot using pip install hypixel. It finished installing without any errors. At the top of my script I have import hypixel. But when I try and run it I get this error:
File "D:\Documents\Discord Bot\Addicts Discord Bot\bot.py", line 1, in <module>
import hypixel
ModuleNotFoundError: No module named 'hypixel'
I am not sure if this is too relevant but my pip isn't the latest version and I get an error when I try and update it.
Edit: I have now successfully updated my pip. But even when I try and reinstall the package it still won't work.
Instead of using pip install python, use pip install hypixel. Then try to import it in your code using import hypixel.
In your question you say you used pip install python, did you mean to say pip install hypixel?
Also if you use python3 but have python3 installed make sure you use pip3.
You can install this with sudo apt-get install python3-pip (assuming you use a debian based distro). Then use sudo pip3 install hypixel
Edit:
For windows installation follow this link
I am trying to build the python api for an open source project called Zulip and I keep running into the same issue as indicated by the screenshot below.
I am running python3 and my pip version is 10.0.0. The file in question is setup.py and the code that is messing up is when the pip.main() attribute is accessed to install a package.
Now, I know this build should succeed because its an open source project, but I have been trying for hours to fix the dependency issue regarding pip.main().
Any help would be greatly appreciated.
python3 -m pip install --user --upgrade pip==9.0.3
pip issue: rollback
It appears that pip did a refactor and moved main to internal. There is a comprehensive discussion about it here: https://github.com/pypa/pip/issues/5240
A workaround for me was to change
import pip
pip.main(...)
to
from pip._internal import main
main(...)
I recommend reading through the discussion, I'm not sure this is the best approach, but it worked for my purposes.
First run
import pip
pip.__version__
If the result is '10.0.0', then it means that you installed pip successfully
since pip 10.0.0 doesn't support pip.main() any more, you may find this helpful
https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program
Use something like
import subprocess
subprocess.check_call(["python", '-m', 'pip', 'install', 'pkg']) # install pkg
subprocess.check_call(["python", '-m', 'pip', 'install',"--upgrade", 'pkg']) # upgrade pkg
pip 10.0.1 still doesn't support main
You can choose to DOWNGRADE your pip version via following command:
python -m pip install --upgrade pip==9.0.3
This helps me, https://pip.pypa.io/en/stable/installing/
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
If you are using python3 and not set it default. do this,
python3 get-pip.py
It works for me.
My solution is to check the version number of pip and use the import the correct main function correctly
import pip
if int(pip.__version__.split('.')[0])>9:
from pip._internal import main
else:
from pip import main
def install(package):
main(['install', package])
To verify whether is your pip installation problem, try using easy_install to install an earlier version of pip:
easy_install pip==9.0.1
If this succeed, pip should be working now. Then you can go ahead to install any other version of pip you want with:
pip install pip==10....
Or you can just stay with version 9.0.1, as your project requires version >= 9.0.
Try building your project again.
If python -m pip install --upgrade pip==9.0.3 doesn't work, and you're using Windows,
Navigate to this directory and move the pip folders elsewhere.
Close your IDE if you have it open.
Press 'Repair' on Python 3.
Your IDE should cease to detect pip packages and prompt you to install them. Install and keep the last stable pip version by blocking automatic updates.
Pip 10.0.* doesn't support main.
You have to downgrade to pip 9.0.3.
Try this command.
python -m pip install --user pip==9.0.1
It works well:
py -m pip install --user --upgrade pip==9.0.3
Edit file:
C:\Users\kpate\hw6\python-zulip-api\zulip_bots\setup.py in line 108
to
rcode = pip.main(['install', '-r', req_path, '--quiet'])
do
rcode = getattr(pip, '_main', pip.main)(['install', '-r', req_path, '--quiet'])ยด
Not sure about Windows. But for mac users, use this:
pip install --upgrade pip==9.0.3
I fixed this problem upgrading to latest version
sudo pip install --upgrade pip
My version:
pip 18.1 from /Library/Python/2.7/site-packages/pip (python 2.7)
I faced the same error while using pip on anaconda3 4.4.0 (python 3.6) on windows.
I fixed the problem by the following command:
easy_install pip==18.* ### installing the latest version pip
Or if lower version pip required, mention the same in the command.
Or you can try installing the lower version and then upgrading the same to latest version as follow:
easy_install pip==9.0.1
easy_install --upgrade pip
For me this issue occured when I was running python while within my site-packages folder. If I ran it anywhere else, it was no longer an issue.
I've installed wx for python on windows with
pip install wxpython
The python script I'm using tries to import wx.gizmos. The program fails there with error "No module names gizmos". So i've tried to install it with
pip install gizmos,
pip install wxgizmos,
pip install wx.gizmos,
pip install wxpython.gizmos,
pip install wxpythongizmos.
Error is "No matching distribution found for..."
I've been to https://wxpython.org/Phoenix/docs/html/main.html and it appears gizmos is not there and so can't be used but the python script needs it.
Is there a way of installing this or a way arond this ?
I uninstalled python wx using:
pip uninstall wxpython.
and reinstalled it from here:
https://sourceforge.net/projects/wxpython/files/wxPython/2.9.5.0/wxPython2.9-win64-2.9.5.0-py27.exe/download