no module named 'pip' on windows while installing openpyxl - python

I am install a third party module for the first time.
I am on python 3.10. I have download the openpyxl and extracted the zip folder into:
D:\Users\XXXX\AppData\Local\Programs\Python\Python310\Lib
Then I went to:
D:\Users\XXXX\AppData\Local\Programs\Python\Python310\Scripts
Typed cmd on the address bar and then typed pip install openpyxl.
This is the message returned:
D:\Users\XXXX\AppData\Local\Programs\Python\Python310\Scripts>pip install openpyxl
Traceback (most recent call last):
File "D:\Users\XXXX\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Users\XXXX\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Users\XXXX\AppData\Local\Programs\Python\Python310\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'

That's because pip is an Alias. The true command is indeed pip3 (or pip2 depending on what Python version you're using). For Ubuntu, there is an useful tool called python3-is-python which creates this alias. Try looking if this also exists for Windows!
Also, make sure you are running the cmd as administrator. It is very common for Windows to not be able to see those commands.

Related

Trouble downloading Python modules

I was making a Tetris game and at the top of the Python code, I put in import pygame, since that was the thing I was thinking of doing and the thing I thought I could only do. My game was complete, the terminal was open, and I ran the code. The terminal gives an error:
Traceback (most recent call last):
File "[removed for safety]", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
So I tried pip installing it with the command pip install pygame, but it just returns a similar error:
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Python34\lib\site-packages\pip\__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: No module named 'typing'
I was using
VSCode, with Python version 3.10.5, 64-bit.
First of all you can uninstall python 3.4 from your system, with this link then you can reinstall python from from the python.org website. Then hopefully pip install pygame would work. Or, if pygame is installed run pip uninstall pygame then pip install pygame
File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
Python34 is mentioned in the error code, which indicates that the terminal runtime retrieves python3.4 instead of 3.10 you mentioned.
This indicates that there are multiple versions of Python in your environment.
You can manually select the Python interpreter by using shortcut "ctrl+shift+P" and typing "python: select interpreter" or click this icon to change the interpreter:
After choosing the correct interpreter, you can use command pip install pygame to install python package at the correct python-lib.

Whenever I want to use pip I get a ModuleNotFoundError

Whenever I type 'pip' into commandline I get:
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python39\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
I already tried to update 'pip' with using c:\python39\python.exe -m pip install --upgrade pip but there I get:
c:\python39\python.exe: No module named pip
If I replace 'pip' with 'pip3' the same thing happens.
Here is a screenshot of the path variable in system environment variables which shows that pip and python are in the path variable.
Does anyone have ideas for me to fix this error so I can continue programming my python programs.
you can try pip3 instead of pip

DeepSpeech Installation Error: "ImportError: DLL load failed: The specified module could not be found."

I am attempting to build a speech-to-text algorithm using Mozilla DeepSpeech, but I am having trouble installing the package.
First, I created a new virtual environment in Anaconda called deepspeech-venv and installed the latest version of the deepspeech package (v0.8.1) via pip in the Anaconda Powershell with the command pip install deepspeech --upgrade.
Next, I downloaded both the pbmm version and the tflite version of the pre-trained English models from Mozilla's GitHub using the commands wget https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.pbmm and wget https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.tflite.
Finally, I wanted to check and make sure that everything installed correctly, so I typed deepspeech -h into the command line, which produced the following error statement:
Traceback (most recent call last):
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\zachary.holden\Anaconda3\envs\deepspeech_venv\Scripts\deepspeech.exe\__main__.py", line 4, in <module>
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\site-packages\deepspeech\__init__.py", line 23, in <module>
from deepspeech.impl import Version as version
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\site-packages\deepspeech\impl.py", line 13, in <module>
from . import _impl
ImportError: DLL load failed: The specified module could not be found.
From what I understand, this means that I'm lacking some dependencies for the deepspeech library; however, I'm not quite sure what additional DLLs need to be installed or even how to go about that process. (Unless, of course, if the issue lies in my installation process, and I merely have to add another library.)
NOTE: I am running Python v3.7.7 on a Windows 10 64-bit system.
I copied the "libdeepspeech.so" file from "lib" directory to directly under "deepspeech" directory as suggested in the below shared link and it worked for me.
Reference Link

Why does my pip install requests giving me an error when i install it?

I tried installing requests with "pip install requests" but it shows this
Traceback (most recent call last):
File "c:\users\me\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\me\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\Scripts\pip.exe\__main__.py", line 9, in <module>
TypeError: 'module' object is not callable
I am on windows 10
That may happens because you don't have proper set PATH of pip in your current machine, instead of use pip install ... you need to specify the python (may vary depending of your python version python3 or python) path and add the -m flag to specify the module that you want to use. in this case pip
try
python -m pip install requests

Fail to use pip in Python 3.4

I used Anaconda to install Python 3.4 under Windows 8. At first, everything is fine, and later the system told me that I need to use pip install pip --upgrade to update pip. After I did this, I got some error information on the screen and then pip can no longer be used.
Now when I try to install some packages using pip, there would be some error information:
C:\Users\E440>pip
Traceback (most recent call last):
File "E:\Program Files\Annaconda\lib\runpy.py", line 170, in _run_module_as_ma
in
"__main__", mod_spec)
File "E:\Program Files\Annaconda\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "E:\Program Files\Annaconda\Scripts\pip.exe\__main__.py", line 5, in <mod
ule>
ImportError: No module named 'pip'
I tried several methods, but still can't fix it. Any suggestions?
You are trying to import pip from your python program; as pip is a linux command, not a python module, this will fail to import the correct program:
import pip
Instead, call it from your bash (linux interpreter):
bash-3.2$ pip install module

Categories