I am trying to install pywin32 behind a proxy, and therefore I had to use the zip, rather than the .exe file available. I have down this with other packages and they work fine.
PS C:\Users\Michael.Spencer\Downloads\pywin32-221\pywin32-221> py -3 setup3.py build
Converting...
Executing...
Building pywin32 3.6.221.0
Traceback (most recent call last):
File "setup3.py", line 16
exec(str(got))
File "<string>", line 1944, in <module>
File "<string>", line 594, in __init__
File "C:\Program Files\Python36\lib\ntpath.py", line 75, in join
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
I have never come across this issue when downloading packages manually. The only issue I can think of is my machine is 64 bit, and maybe the zip file only contains a 32 bit version? However from what I've read, that would result in a different errortype. Any help is appreciated thanks.
An alternate simpler way to install, just re-iterating from the comments, is instead of building from source would be,
pip install pypiwin32
and to install in a different directory, for whatever reason,
pip install --target=[path] pypiwin32
from
Install a Python package into a different directory using pip?
Related
I did a fresh install of Python 3.8.3 for Windows 10. I can't get pip to work, it keeps complaining about module pip._internal.utils that can't be found.
When I run pip -v as a regular user, this is what I get:
Traceback (most recent call last):
File "c:\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python38\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\verhager\AppData\Roaming\Python\Python38\site-packages\pip\__init__.py", line 1, in <module>
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
File "C:\Users\verhager\AppData\Roaming\Python\Python38\site-packages\pip\_internal\__init__.py", line 1, in <module>
import pip._internal.utils.inject_securetransport # noqa
ModuleNotFoundError: No module named 'pip._internal.utils'
I have tried reinstalling, rebooting, running as Administrator, reinstalling pip with get_pip.py, but nothing has worked sofar.
When searching, I found several people having similar issues on different OSes. It seems like I've tried all suggested solutions, but nothing has worked for me sofar.
Reinstalling didn't solve my problem. That is, not before I really made sure that nothing was left behind.
My Python install was in C:\Python38\. After uninstalling python, this directory remained and contained some left over modules, like pip. I manually deleted the whole C:\Python38 folder.
Then, I checked my AppData folder in my home dir. Everything in this folder and all subfolders that was related to Python or Python modules, I deleted as well. Keep in mind AppData is a hidden folder, so it you might have to enable showing of hidden files and folders in the explorer first.
Finally, I removed all Python folders from my PATH environment variables (system as well as user).
After that, I did a new install of Python 3.8 and everything works as expected.
What I think the problem was? Some left overs from a previously (broken) installation messed with my environment, causing pip not resolving required modules.
I had the same error as you, with Windows 10. I also investigated and found that the "pip._internal.utils" package was missing. I was able to overcome this issue without an extensive Cleanup/Reinstall of Python.
After ensuring the following
That the Python Binary and Scripts folders were part of %PATH%
That I was on a Console Window with Administrator privileges
I ran the following command
python -m ensurepip --default-pip
With this command the package was installed. I did a general verification of the installation with the following command.
pip --version
Which returned the with specs. This command invokes the missing package.
I faced the same issue and here's how I resolved this error on windows 7 -
Navigate to C:\Users<user-name>\AppData\Roaming\Python\Python38\site-packages
Delete pip folder
This is introduced when I read this messsage
"You should consider upgrading via the 'python -m pip install --upgrade pip' comand." and followed using the same command for upgrading.
I need to open SVS images in Python 3.7 and it seems that Openslide is the only module capable of opening images of that size (30k*30k pixels). I have used pip install openslide-python as well as python -m pip install openslide-python and pip 3 install... etc.
I know the module has been successfully installed because if I run any of those commands again the command line returns requirement already satisfied however when I run Python and try to import openslide it gives the error at the bottom.
My guess was that the .whl or .tar.gz files were in the wrong path so I made a bunch of copies and put them in the openslide folders within the Anaconda3 folder. The error persists. I have included the full error code below for clarity.
Extra: If I run help("modules") openslide shows up along with numpy, math, sklearn etc. I can import and run all other modules without issue.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\brimk\Anaconda3\lib\site-packages\openslide\__init__.py", line 29, in <module>
from openslide import lowlevel
File "C:\Users\brimk\Anaconda3\lib\site-packages\openslide\lowlevel.py", line 41, in <module>
_lib = cdll.LoadLibrary('libopenslide-0.dll')
File "C:\Users\brimk\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\brimk\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
My issue was resolved by the answer from my hero!
It seems that, at least for Openslide, running Python from the Path to the Bin is the easiest solution. It can be done this way.
Download the Windows Binary here.
Extract the download to whatever path you want.
Open command window
pip3 install openslide-python (pip2 if Python 2)
cd C:\Users\Path\to\Openslide-Win64-20171122\bin
python
import openslide
In the future you will have to run python from the path to the Openslide bin (Step 4). This can be done more rigorously by adding that file path to the PATH as described in detail here as well as in the answer above.
I'm running conda 4.4.8 on mac OS 10.11.16 and I'm trying to properly install a third-party package that I have as a tar.gz file. The package installation seems to work without any issue (having already tried to install, this in what I get when I run it again):
$: pip install ~/Downloads/pydelay-0.1.1.tar.gz
Processing ~/Downloads/pydelay-0.1.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pydelay==0.1.1 from file://~/Downloads/pydelay-0.1.1.tar.gz in ~/anaconda3/lib/python3.6/site-packages
Building wheels for collected packages: pydelay
Running setup.py bdist_wheel for pydelay ... done
Stored in directory: ~/Library/Caches/pip/wheels/5d/b7/4e/3896677f80cccebfc2d300904aca54ebbd6b0885cb9440e13d
Successfully built pydelay
Then I do a check to make sure there aren't dependencies missing:
$: pip check pydelay
No broken requirements found.
However, when I run my piece of code that uses the package, I get the following error:
runfile('~/.../DDEin3+1D.py', wdir='~/...')
Traceback (most recent call last):
File "ipython-input-16-12e8207a0dca", line 1, in
runfile('~/.../DDEin3+1D.py', wdir='~/...')
File "~/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "~/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "~/.../DDEin3+1D.py", line 18, in
from pydelay import dde23
File "~/anaconda3/lib/python3.6/site-packages/pydelay/__init__.py", line 9, in
from _dde23 import dde23
ModuleNotFoundError: No module named '_dde23'
I don't think its a version problem, but because the pydelay package is from 2009 it very well could be.
Any help with getting the spyder editor (or command line python) to find this package would be greatly appreciated!
pythonanaconda3
Just in case anyone runs into something like this, I thought I would post the solution. In this instance, the __init__.py file was searching my default PATH for _dde23, which was actually located in the same directory as __init__.py. The solution was simply to change the import call in __init__.py to
from ._dde23 import dde23
This told the file to look within the same directory for the module. I found similar problems throughout the package, and with this small change solved them all. I'm not an expert, but it might have been something to do with pydelay being built with python2.x while I was running python3.x.
Of course, getting other parts of this module to work with depreciated dependencies is another matter ;)
I have a Windows machine running many apps using Python 2. I want to add a new program I wrote using Python 3. To make sure I don't screw anything up, I wanted to use a Virtualenv with Python 3 embedded (Python 3 embed amd64).
So I extracted the embedded python 3 and tried running virualenv with the --python option enabled.
I tried running the virtualenv
python -m virtualenv --python E:\Projects\python3-embed\python.exe E:\Projects\Virtual\
And I got this error:
Running virtualenv with interpreter E:\Projects\python3-embed\python.exe
Using base prefix 'E:\\Projects\\python3-embed'
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\virtualenv.py", line 2328, in <module>
main()
File "C:\Python27\lib\site-packages\virtualenv.py", line 713, in main
symlink=options.symlink)
File "C:\Python27\lib\site-packages\virtualenv.py", line 925, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "C:\Python27\lib\site-packages\virtualenv.py", line 1147, in install_python
writefile(site_filename_dst, SITE_PY)
File "C:\Python27\lib\site-packages\virtualenv.py", line 362, in writefile
with open(dest, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'E:\\Projects\\Virtual\\python36.zip\\site.py'
I am not entirely sure how can I fix this error. There is a site.pyd file in python36.zip but it seems that virtualenv can't use it.
Sorry in advance
I knew this is not the answer you meant to ask for, but I tried hard that (our) way, and got this solution at last.
TL;DR
Update on 17 December 2021
The download page has been moved to https://winpython.github.io/
, for my purpose, I will download Winpython64-3.10.0.1dot.exe for now. Please don't forget to verify the checksum for the executable package.
End of the update on 17 December 2021
Use the portable installer with postfix "Zero" from WinPython
WinPython64-3.7.0.2Zero.exe(64 bit version, YOU want this)
WinPython32-3.7.0.2Zero.exe(32 bit version)
The Too Long version
What I tried
Yes, I downloaded the python-3.7.0-embed-amd64.zip from this page
Yes, I set it up according to instructions in this page
Yes, it worked as a python interpreter
D:\temp\test>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
>>>
Yes, I installed the package virtualenv
D:\temp\test>virtualenv --version
16.0.0
Then, boom (where you asked)
D:\temp\test>virtualenv ENV
Using base prefix 'd:\\portable\\python-3.7.0-embed-amd64'
Traceback (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "D:\portable\python-3.7.0-embed-amd64\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "D:\portable\python-3.7.0-embed-amd64\lib\site-packages\virtualenv.py", line 712, in main
symlink=options.symlink)
File "D:\portable\python-3.7.0-embed-amd64\lib\site-packages\virtualenv.py", line 927, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "D:\portable\python-3.7.0-embed-amd64\lib\site-packages\virtualenv.py", line 1149, in install_python
writefile(site_filename_dst, SITE_PY)
File "D:\portable\python-3.7.0-embed-amd64\lib\site-packages\virtualenv.py", line 363, in writefile
with open(dest, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\temp\\test\\ENV\\python37.zip\\site.py'
Seems a problem with virtualenv, searched, got an open issue, and I don't like that long solution.
This is the end of virtualenv.
Then, I tried venv:
D:\temp\test>python -m venv venv
D:\portable\python-3.7.0-embed-amd64\python.exe: No module named venv
Yes, the "built-in module" was lost, and the document for Embedded Distribution doesn't even mention it, just something about Tcl/tk (...), pip and the Python documentation are not included.
This is the end of venv.
Well, start again from my original point
The purpose to choose Embedded Distribution is (just like SOMEBODY):
To make sure I don't screw anything up
this include "don't install anything into my unstable and oversized Windows"
but doesn't necessarily "must use the Official Embedded Distribution"
something portable and trusted is enough, yes Portable Python
but the main page says "Portable Python is not being developed anymore", and provide some choice
after some reading, I figured out, what I want is WinPython, the version with a Zero
ta-da ... That's it.
Something about Embedded Distribution (from official document)
The embedded distribution is a ZIP file containing a minimal Python environment. It is intended for acting as part of another application, rather than being directly accessed by end-users.
The embedded distribution is meant to be lightweight. To install a virtual environment, follow these steps.
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
Once these steps are done, proceed with the recommended approach and create a virtual environment using the command below. The --system-site-packages is typically used to bring a non embedded distribution packages already in the python install into the virtual environment, but since this is embedded, you can omit. But it won't hurt to have it.
python -m venv --system-site-packages C:\Python\python-3.7.9-embed-amd64\py37venv
I am experiencing a problem when using virtualenv in openSuSE 12.3 with Python3:
I installed the python3 and python3-devel packages.
Then I installed the newest distribute and pip and finally virtualenv using pip.
When I try to create a virtualenv I get the following error:
$ virtualenv-3.3 venv01
Using base prefix '/usr'
New python executable in venv01/bin/python3.3
Also creating executable in venv01/bin/python
Installing distribute.........................................................................................................................................................................................................................................................................................................................................................................................................done.
Installing pip....
Complete output from command /home/user/venv01/bin/python3.3 -x /home/user/venv01/bin/easy_install /usr/local/lib/pytho...ort/pip-1.3.1.tar.gz:
/home/user/venv01/bin/python3.3: can't open file '/home/user/venv01/bin/easy_install': [Errno 2] No such file or directory
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv-3.3", line 9, in <module>
load_entry_point('virtualenv==1.9.1', 'console_scripts', 'virtualenv-3.3')()
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 979, in main
no_pip=options.no_pip)
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 1094, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 667, in install_pip
filter_stdout=_filter_setup)
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 1057, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/user/venv01/bin/python3.3 -x /home/user/venv01/bin/easy_install /usr/local/lib/pytho...ort/pip-1.3.1.tar.gz failed with error code 2
Running it with -vvv yields some interesting output that shows that distribute
is extracted to <venv>/local/lib/python3.3/site-packages/.
I wonder why distribute is not installed into <venv>/lib/python3.3/site-packages/?
Does anyone have an idea why this happens and how I can use virtualenv in
openSuSE without compiling python3 myself?
[now fixed in latest patches from opensuse]
[oh! i just realised you are the same person as the original link. sorry. but i will leave this as it is a top result for google search on this issue (was searching myself for any update) so it may help others.]
this is a known issue, discussed at https://forums.opensuse.org/english/get-technical-help-here/applications/484475-using-virtualenv-python-3-a.html and with an open bug at https://bugzilla.novell.com/show_bug.cgi?id=809831
the only work-around i know of is to install everything yourself. it's not so hard, and i describe what is necessary at http://www.acooke.org/cute/GettingPyt0.html
basically:
install python 3.3 from source (do an "altinstall" to install as /usr/local/bin/python3.3)
fix the lib issue (link lib_dynload from /usr/local/lib64/python3.3 to /usr/local/lib/python3.3)
install distutils
install virtualenv
then you can use python3.3 and virtual-env-3.3 etc as expected.