I am unable to download anything using "pip" function - python

When I try to install any module for python using command prompt or PowerShell, then there is a message that shows up, the message is:
File "c:\users\opkp\app data\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\OPKP\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 7, in <module>
from .connectionpool import (
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
ModuleNotFoundError: No module named 'pip._vendor.urllib3.exceptions'
I know it has the names of my drivers and all. Due to this, I am not able to download any module for python.
Things that I have tried and that failed me:
I Googled it
YouTube videos were not tackling my problem, what they were telling me is just how to install pip (which I already have) and how to add the path (which I have already done)
Commands that gave this error:
pip install flask
py -m ( I don't remember it fully but i wrote it correctly )
pip3 install flask
and i have also uninstalled and installed python
etc.
Here is my error message in the command prompt:
I also tried that py -m statement but that also gave the same result.

You can try to re-install pip or even completely re-install Python.

Related

problems installing a DVC lower version [0.9.4]

I need to install an older version of DVC, namely 0.9.4, in a Python virtual environment.
I used the command:
pip install dvc==0.9.4
Everything seemed to work fine. However, when I try to run a dvc pull command, I get the following error:
Traceback (most recent call last):
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\lbrandao\anaconda3\envs\my_env\Scripts\dvc.exe\__main__.py", line 4, in <module>
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\main.py", line 2, in <module>
from dvc.cli import parse_args
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cli.py", line 8, in <module>
from dvc.command.init import CmdInit
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\command\init.py", line 1, in <module>
from dvc.project import Project
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\project.py", line 15, in <module>
from dvc.cloud.data_cloud import DataCloud
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cloud\data_cloud.py", line 11, in <module>
from dvc.cloud.gcp import DataCloudGCP
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cloud\gcp.py", line 4, in <module>
from google.cloud import storage as gc
ModuleNotFoundError: No module named 'google.cloud'
When I print the dvc version, I see:
0.9.4+6bb66e.mod
Can anyone please help? Thanks.
Assuming the remote storage is on Google Cloud based on that error, you may need to install the special dvc[gs] module instead, e.g.:
pip install dvc[gs]==0.9.4
See https://dvc.org/doc/install/linux#install-with-pip
BTW DVC 1.x should be backward compatible with DVC 0.9 in case you want to try a newer version.
Also, try to migrate your project to DVC 2.x (latest as of now), here are some guidelines: https://dvc.org/blog/dvc-2-0-release#breaking-changes
I was able to overcome the previous issue with:
pip install --upgrade google-cloud-storage

My pip is broken on Windows, how can I fix it?

Whenever I try to use pip, using any command I get this:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsdra8p0\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsd8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_q3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\progress_bars.py", line 8, in <module>
from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
ModuleNotFoundError: No module named 'pip._vendor.progress'
PS C:\Users\SE> No module named 'pip._vendor.progress'No module named 'pip._vendor.progress'
I am on Windows 10, 64 bit, Python version 3.7.7.
I cannot use pip, how can I fix it?
If pip is broken after an attempted upgrade to a newer version, try the following:
Download get-pip.py and "Save As" the file using right-click.
Open a command prompt as an administrator
cd to the path where you saved the file, in my case
cd C:\Users\xyz\Downloads> then type python get-pip.py. It will install all required packages, such as wheel and pip.
To check if it installed correctly, type pip --version in the command line.
Hope my answer helps someone. Happy coding. 🙂
Try doing python -m pip install pytest. This should install it, and it will make it usable by your IDE.
Hope this helps!
You could follow the equivalent steps mentioned here and here (Both are closed issues on pip's github page) on your windows machine.
On windows you can do this:
python -m pip uninstall pip setuptools # Sometimes setuptools might be the problem
This will uninstall pip and setuptools.
After which you can reinstall them using
python -m ensurepip
This will install pip and setuptools.
I have tried this on my windows 10 machine running Python 3.7.4!

Add matplotlib package to python shipped with 3rd party software?

Let me begin by saying I am very new to python so I will try to be as concise as possible, but please read my question with that thought in mind and have mercy on my ignorant soul.
I am working with an application, written in C++, that ships with Python version 3.4. The software allows users to write Python scripts and save them to a directory in order to control the program through these custom scripts. However, the Python library that ships with the software doesn't include matplotlib. Is it possible to use the pip installer to install matplotlib in this program's Python directory? I tried using --target with the pip installer, but that has not worked for me. If I cannot use pip, can anyone direct me to some documentation that might help me understand how to add packages to Python shipped within another program?
Furthermore, for future reference, is it possible to upgrade the version of Python within this program to Python 3.7 without access to the program's C++ source code?
Thank you for any input and help, and for not spitefully bashing my poorly posited question.
Edit:
Running path\to\python.exe -m site yielded the following:
C:\>"C:\path\python34\python.exe" -m site
sys.path = [
'C:\\',
'C:\\path\\python34\\python34.zip',
'C:\\path\\DLLs',
'C:\\path\\lib',
'C:\\path\\python34',
'C:\\path\\python34\\lib\\site-packages',
]
USER_BASE: 'C:\\Users\\user\\AppData\\Roaming\\Python' (exists)
USER_SITE: 'C:\\Users\\user\\AppData\\Roaming\\Python\\Python34\\site-packages' (doesn't exist)
ENABLE_USER_SITE: True
Running the command "path\python34\python" "path\pip-20.0.2-py2.py3-none-any.whl\pip" install -U -I pip yields the following output and subsequent error:
Traceback (most recent call last):
File "C:\path\python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\path\python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\__main__.py", line 16, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\main.py", line 10, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\autocompletion.py", line 9, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\main_parser.py", line 7, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\cmdoptions.py", line 28, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\models\target_python.py", line 4, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\utils\misc.py", line 20, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_vendor\pkg_resources\__init__.py", line 35, in <module>
File "C:\path\python34\lib\plistlib.py", line 65, in <module>
from xml.parsers.expat import ParserCreate
File "C:\path\python34\lib\xml\parsers\expat.py", line 4, in <module>
from pyexpat import *
ImportError: DLL load failed: The specified procedure could not be found.

VIRTUALENVWRAPPER fails with zlib import error after EL CAPITAN update

After a recent El Capitan update, when I open the terminal I get the error below without attempting anything.
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/site-packages/virtualenvwrapper/hook_loader.py", line 8, in <module>
import inspect
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 39, in <module>
import tokenize
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tokenize.py", line 29, in <module>
from itertools import chain
ImportError: No module named itertools
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.
If I run python (2.7.9) in the command line it works, but it fails when I try to import zlib with no module zlib error.
I tried to reinstall pip through easy install, so I can reinstall virtualenv and virtualenvwrapper, but when I try sudo easy install I get "zipimport.ZipImportError: can't decompress data; zlib not available".
So I then tried to change the .bash_profile, but I really don't know how to change it, because I don't understand path and environmental variables. CURRENT bash_profile content is:
export PATH=/usr/local/share/python:$PATH
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
My last hope is that if I can point the path in the right direction everything will get solved.

Problems getting twill installed and working in python 2.7

I installed twill by using pip, and another try using easy_install, I want to play around with it in Powershell. Following this page - http://twill.idyll.org/ I wanted to play around with it.
To start using twill, install it and then type twill-sh. At the prompt type:
go http://www.slashdot.org/
show
showforms
showhistory
When I type twill-sh it doesn't work. I have typed it in power shell, tried it after loading python, and tried it after using import twill and trying it. I only get errors.
Traceback (most recent call last):
File "C:\Python27\Scripts\twill-sh-script.py", line 9, in <module>
load_entry_point('twill==1.8.0', 'console_scripts', 'twill-sh')()
File "build\bdist.win32\egg\pkg_resources.py", line 356, in load_entry_point
File "build\bdist.win32\egg\pkg_resources.py", line 2439, in load_entry_point
File "build\bdist.win32\egg\pkg_resources.py", line 2155, in load
File "C:\Python27\lib\site-packages\twill\__init__.py", line 52, in <module>
from shell import TwillCommandLoop
File "C:\Python27\lib\site-packages\twill\shell.py", line 9, in <module>
from twill import commands, parse, __version__
File "C:\Python27\lib\site-packages\twill\commands.py", line 7, in <module>
from lxml import html
How do I just load modules so I can play with them without writing scripts?
I had the same problem. Further down the log I found the following:
File "C:\Anaconda\lib\site-packages\lxml\cssselect.py", line 18, in <module> raise ImportError('cssselect seems not to be installed. '
ImportError: cssselect seems not to be installed. See http://packages.python.org/cssselect/
Which I fixed by installing package cssselect (using conda as I have an Anaconda installation, pip should do the same).
conda install cssselect

Categories

Resources