Can't seem to use PIP to install my own module - python

I am following the 2nd edition of Head First Python by Paul Barry to try and learn to use python. I've made it to a point where I have created a function, put it in a module, then created a distribution file for that modules. Now I want to install it on my computer, but I can't seem to get the distribution file to run on my computer.
My code inserted into Windows 10 command prompt and the resulting errors:
C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\mymodules\dist> py -3 -m pip install vlsearch-1.0.tar
Requirement 'vlsearch-1.0.tar' looks like a filename, but the file does not exist
Processing c:\users\coolt\appdata\local\programs\python\python36-32\mymodules\dist\vlsearch-1.0.tar
Exception:
Traceback (most recent call last):
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\download.py", line 809, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\download.py", line 715, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\utils\__init__.py", line 602, in unpack_file
tarfile.is_tarfile(filename) or
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\tarfile.py", line 2448, in is_tarfile
t = open(name)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\tarfile.py", line 1569, in open
return func(name, "r", fileobj, **kwargs)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\tarfile.py", line 1634, in gzopen
fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj)
File "C:\Users\coolt\AppData\Local\Programs\Python\Python36-32\lib\gzip.py", line 163, in __init__
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\coolt\\AppData\\Local\\Programs\\Python\\Python36-32\\mymodules\\dist\\vlsearch-1.0.tar'
You are using pip version 9.0.3, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I'm very confused because the file definitely exists in the spot that I am specifying. How do I get it installed?
the file exists in the folder that I expect it to

Related

Python package installation error for openCV

C:\Users\Om>pip install opencv_python-3.2.0-cp36-cp36m-win32.whl
Requirement 'opencv_python-3.2.0-cp36-cp36m-win32.whl' looks like a filename, but the file does not exist
Processing c:\users\om\opencv_python-3.2.0-cp36-cp36m-win32.whl
Exception:
Traceback (most recent call last):
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py", line 809, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py", line 715, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils__init__.py", line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "c:\users\om\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils__init__.py", line 482, in unzip_file
zipfp = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Om\opencv_python-3.2.0-cp36-cp36m-win32.whl'
what is the problem ?
It looks like you have not given a valid file location.
The error is saying that it thinks you have given it a whl file to install but it can't find it.
I suggest you check you file path again.
Make sure it is located at C:\Users\Om and it is called exactly the same as the filename you have put down. It should match opencv_python-3.2.0-cp36-cp36m-win32.whl exactly.
Ensure you do not rename the whl file.
Correct that and it will attempt an install and if that does not work you will get another error.

Hit ctrl-c during a pip install of spacy, now getting error when attempt to install again

I am trying to install spacy. I am on CentOS Linux
!pip install -U spacy
in a jupyter notebook and everything was working fine. During the installation, I realized I intended to include the --user command since I intended to install for my user only, so I hit ctrl-c. At this point the installation is incomplete.
Trying to install the package again with pip is now giving me an error, regardless of whether I include the --user flag. I think the error, below, is related to the incomplete build. Does anyone know how to fix this?
Collecting spacy
Exception:
Traceback (most recent call last):
File "/opt/anaconda2/lib/python2.7/site-packages/pip/basecommand.py", line
215, in main
status = self.run(options, args)
File "/opt/anaconda2/lib/python2.7/site-packages/pip/commands/install.py",
line 335, in run
wb.build(autobuilding=True)
File "/opt/anaconda2/lib/python2.7/site-packages/pip/wheel.py", line 749, in
build
self.requirement_set.prepare_files(self.finder)
File "/opt/anaconda2/lib/python2.7/site-packages/pip/req/req_set.py", line
380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/opt/anaconda2/lib/python2.7/site-packages/pip/req/req_set.py", line
620, in _prepare_file
session=self.session, hashes=hashes)
File "/opt/anaconda2/lib/python2.7/site-packages/pip/download.py", line 809,
in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "/opt/anaconda2/lib/python2.7/site-packages/pip/download.py", line 715,
in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "/opt/anaconda2/lib/python2.7/site-packages/pip/utils/__init__.py",
line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "/opt/anaconda2/lib/python2.7/site-packages/pip/utils/__init__.py",
line 484, in unzip_file
zip = zipfile.ZipFile(zipfp, allowZip64=True)
File "/opt/anaconda2/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/opt/anaconda2/lib/python2.7/zipfile.py", line 811, in _
RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file`
Thanks everyone. A solution that worked for me was to go to $HOME/.cache/pip and delete the contents of http/ and wheels/

Pip install failure for tensorflow-gpu - OSError: raw write() returned invalid length

When installing tensorflow-gpu 1.4.0 using pip in Windows 10 (Python 3.5), I get the following strange error. Very interestingly, each time I run
pip.exe install tensorflow-gpu
it downloads a small but seemingly random part of the package, then raises the following exception:
(C:\Users\carth\Anaconda3\envs\py35) E:\Data\ownCloud\Work\CoronaryML>pip.exe install tensorflow-gpu
Collecting tensorflow-gpu
Downloading tensorflow_gpu-1.4.0-cp35-cp35m-win_amd64.whl (67.6MB)
Exception: | 266kB 797kB/s eta 0:01:25
Traceback (most recent call last):
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 659, in unpack_http_url
hashes)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 571, in written_chunks
for chunk in chunks:
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\utils\ui.py", line 141, in iter
self.next(n)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\__init__.py", line 73, in next
self.update()
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\bar.py", line 41, in update
self.writeln(line)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\helpers.py", line 67, in writeln
self.clearln()
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\helpers.py", line 63, in clearln
print('\r\x1b[K', end='', file=self.file)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 166, in write_and_convert
self.write_plain_text(text, cursor, start)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 174, in write_plain_text
self.wrapped.write(text[start:end])
OSError: raw write() returned invalid length 2 (should have been between 0 and 1)
I tried turning off my antivirus, in case that was killing it, but it didn't help.
In the end, I managed to install it by downloading the .whl from PyPI manually, then running pip.exe install path/to/.whl, but I'd like to understand what caused the original failure.
Any ideas?
This issue has been documented here, you can update to python 3.6 or install and enable the win_unicode_console package to solve it
https://bugs.python.org/issue32245
Switch to cmd with administrator rights to run the command:
pip3 install --ignore-installed --upgrade tensorflow-gpu -i https://pypi.tuna.
tsinghua.edu.cn/simple

Raspberry python3.4 pip error unknown encoding cp437

Yesterday I was testing some python code in my raspberry pi 3 (raspbian jessie), it required the package pytz, so I did:
sudo python3 -m pip install pytz
And then this happens:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 290, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1198, in prepare_files
do_download,
File "/usr/lib/python3/dist-packages/pip/req.py", line 1376, in unpack_url
self.session,
File "/usr/lib/python3/dist-packages/pip/download.py", line 582, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/usr/lib/python3/dist-packages/pip/util.py", line 640, in unpack_file
unzip_file(filename, location, flatten=not filename.endswith(('.pybundle', '.whl')))
File "/usr/lib/python3/dist-packages/pip/util.py", line 510, in unzip_file
zip = zipfile.ZipFile(zipfp)
File "/usr/lib/python3.4/zipfile.py", line 937, in __init__
self._RealGetContents()
File "/usr/lib/python3.4/zipfile.py", line 1016, in _RealGetContents
filename = filename.decode('cp437')
LookupError: unknown encoding: cp437
It's not only with pytz, I tried to update/upgrade/reinstall pip with:
sudo python3 -m pip install -U pip
And the same error happens
Any idea about how to solve this problem?
I was searching and trying to solve it yesterday
and everything I can do right now is format the SD card.
My Pip version is 1.5.6 but I can't update it, even downloading the code and running setup.py, same problem.
I tried everything I could, and in my case I will recommend:
Copy all your important codes, changes, documents...
Format the SD and start all over again
I've been having short blackouts lately, that corrupted the SD card.

IOError: [Errno 28] No space left on device while installing pytorch

l got the following error when installing pytorch
pip install http://download.pytorch.org/whl/cu80/torch-0.1.11.post5-cp27-none-linux_x86_64.whl
Collecting torch==0.1.11.post5 from http://download.pytorch.org/whl/cu80/torch-0.1.11.post5-cp27-none-linux_x86_64.whl
Downloading http://download.pytorch.org/whl/cu80/torch-0.1.11.post5-cp27-none-linux_x86_64.whl (475.7MB)
100% |████████████████████████████████| 475.7MB 3.5MB/s
the following error
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 663, in unpack_http_url
unpack_file(from_path, location, content_type, link)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 501, in unzip_file
fp.write(data)
IOError: [Errno 28] No space left on device
What's wrong ? l don't understand the error coming from /python2.7/dist-packages/pip/
In my case the system /tmp ran out of space, hence the error despite the installation path has enough space left.
export TMPDIR=/where/you/have/enough/space/left solves the problem for me.
faced and solved same problem,
when I pip uninstall pipenv, then no error occur, maybe you should uninstall some python packages.

Categories

Resources