How to install pbr module manully? - python-3.x

I'm installing python-jenkins manually by downloading the module and using python setup.py install. pbr is one of the dependency for that. I have tried to do the same step for pbr also i.e download the project zip from GitHub and python setup.py install, but facing the
error
$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 21, in <module>
**util.cfg_to_args())
File "C:\Users\shivansh.trn\Desktop\pbr-master\pbr\util.py", line 256, in cfg_to_args
pbr.hooks.setup_hook(config)
File "C:\Users\shivansh.trn\Desktop\pbr-master\pbr\hooks\__init__.py", line 25, in setup_hook
metadata_config.run()
File "C:\Users\shivansh.trn\Desktop\pbr-master\pbr\hooks\base.py", line 27, in run
self.hook()
File "C:\Users\shivansh.trn\Desktop\pbr-master\pbr\hooks\metadata.py", line 26, in hook
self.config['name'], self.config.get('version', None))
File "C:\Users\shivansh.trn\Desktop\pbr-master\pbr\packaging.py", line 849, in get_version
name=package_name))
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name pbr was given, but was not able to be found.
I can't use pip install python-jenkins or pip install pbr directly due to internet restrictions.

Related

psycopg2-binary fails to install when installing it with pipenv

I am having trouble installing psycopg2-binary (A postgreSQL backend dependecy) in my django project when i use the pipenv utility. However, it installs without any problems if i manually create a virtual environment and use pip install to install it.
Here is what I am getting in the terminal
(django-project-FDld66dG) chilusoft#vortex:~/PycharmProjects/django-project$ pipenv install -r requirements.txt
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project.
Requirements file provided! Importing into Pipfile…
Pipfile.lock (9e16cc) out of date, updating to (79ab59)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
lf.repository.get_dependencies(ireq)
File "/usr/lib/python3/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 174, in get_dependencies
legacy_results = self.get_legacy_dependencies(ireq)
File "/usr/lib/python3/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 222, in get_legacy_dependencies
result = reqset._prepare_file(self.finder, ireq, ignore_requires_python=True)
File "/usr/lib/python3/dist-packages/pipenv/patched/notpip/req/req_set.py", line 644, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/lib/python3/dist-packages/pipenv/patched/notpip/req/req_set.py", line 134, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/lib/python3/dist-packages/pipenv/vendor/pip9/req/req_install.py", line 435, in run_egg_info
call_subprocess(
File "/usr/lib/python3/dist-packages/pipenv/vendor/pip9/utils/__init__.py", line 705, in call_subprocess
raise InstallationError(
pip9.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpbix8dadtbuild/psycopg2-binary/
I do not want to use pip, but would rather use pipenv, what can I do in order to sort this out?

Installing pygame fails on local file [duplicate]

This question already has answers here:
Cannot install pygame in Pycharm
(1 answer)
pycharm doesn't recognize pygame package
(2 answers)
Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'dir:\projectPath\venv\Scripts\python.exe'
(8 answers)
Closed 2 years ago.
I am trying for a while now to install pygame into my Project but whatever I try is doesn’t work. The real frustrating part is that I managed to do it in the past. Witch might be the problem, but I am getting ahead of myself.
Environment:
Python 3.8
Windows 10
I use PyCharm
pip install pygame
i get:
Collecting pygame
Using cached
https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441
db2be/pygame-1.9.6.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most
recent call last):
File "<string>", line 1, in <module>
File "C:\Users\User\AppData\Local\Temp\pip-install-la9vy5w2\pygame\setup.py", line 194, in
<module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\User\AppData\Local\Temp\pip-install-la9vy5w2\pygame\buildconfig\config.py", line
210, in main
deps = CFG.main(**kwds)
File "C:\Users\User\AppData\Local\Temp\pip-install-la9vy5w2\pygame\buildconfig\config_win.py",
line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\User\AppData\Local\Temp\pip-install-
la9vy5w2\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\User\AppData\Local\Temp\pip-
install-la9vy5w2\pygame\
I fould someone else who had the sme problem here:
Pip Install EOFError
and also:
Unable to install pygame on Python 3.8 via pip (Windows 10)
So I tried:
pip install pygame==2.0.0.dev6
I got:
Collecting pygame==2.0.0.dev6
Using cached
https://files.pythonhosted.org/packages/c5/a0/63f9ca836e6a08e560f1ef3f2535ffb46bfdad2abb093dd097dae25
2be28/pygame-2.0.0.dev6.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\setup.py", line 258, in
<module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\buildconfig\config.py", line
208, in main
deps = CFG.main(**kwds)
File "C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\buildconfig\config_win.py", line 559, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\buildconfig\download_win_prebuilt.py", line 269, in ask
update(x86=x86, x64=x64, sdl2=sdl2)
File "C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\buildconfig\download_win_prebuilt.py", line 252, in update
download_prebuilts(download_dir, x86=x86, x64=x64, sdl2=sdl2)
File "C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\buildconfig\download_win_prebuilt.py", line 101, in download_prebuilts
download_sha1_unzip(url, checksum, temp_dir, 1)
File "C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\buildconfig\download_win_prebuilt.py", line 17, in download_sha1_unzip
import requests
ModuleNotFoundError: No module named 'requests'
Making dir :prebuilt_downloads:
---
For help with compilation see:
https://www.pygame.org/wiki/CompileWindows
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\User\AppData\Local\Temp\pip-install-uf_w85qw\pygame\
I also tried some other stuff, like updating pip, but in the end I ended up with the same error message again. (If us want to see the full log just say it and I will upload the other 2 pages of error message.)
Am I right in my assumption that pip tries to install the game from a local file and that file is somehow corrupted or something?
If so how can I make pip install the packed form the Internet?
If not what is the problem?
I can even life with some weird solution like coping a entire project including its packages. (ok that would bug me a little, but as long as it works ...)
Since it was suggested to me I tried
pip install requests
in a new project:
Collecting requests
Using cached
https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
Collecting chardet<4,>=3.0.2 (from requests)
Using cached
https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests)
Using cached
https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl
Collecting idna<3,>=2.5 (from requests)
Using cached
https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests)
Using cached
https://files.pythonhosted.org/packages/9f/f0/a391d1463ebb1b233795cabfc0ef38d3db4442339de68f847026199e69d7/urllib3-1.25.10-py2.py3-none-any.whl
Installing collected packages: chardet, certifi, idna, urllib3, requests
Successfully installed certifi-2020.6.20 chardet-3.0.4 idna-2.10 requests-2.24.0 urllib3-1.25.10
and than:
pip install pygame==2.0.0.dev6
leading to:
Collecting pygame==2.0.0.dev6
Using cached https://files.pythonhosted.org/packages/c5/a0/63f9ca836e6a08e560f1ef3f2535ffb46bfdad2abb093dd097dae252be28/pygame-2.0.0.dev6.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\setup.py", line 258, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\buildconfig\config.py", line 208, in main
deps = CFG.main(**kwds)
File "C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\buildconfig\config_win.py", line 559, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\buildconfig\download_win_prebuilt.py", line 269, in ask
update(x86=x86, x64=x64, sdl2=sdl2)
File "C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\buildconfig\download_win_prebuilt.py", line 252, in update
download_prebuilts(download_dir, x86=x86, x64=x64, sdl2=sdl2)
File "C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\buildconfig\download_win_prebuilt.py", line 101, in download_prebuilts
download_sha1_unzip(url, checksum, temp_dir, 1)
File "C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\buildconfig\download_win_prebuilt.py", line 37, in download_sha1_unzip
raise ValueError(
ValueError: url:https://bitbucket.org/llindstrom/pygame/downloads/prebuilt-x64-pygame-1.9.2-20150922.zip should have checksum:3a5af3427b3aa13a0aaf5c4cb08daaed341613ed: Has:9571d3c5ad8347afb0b101bc242ef5da1a46bb11:
Making dir :prebuilt_downloads:
Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.10-VC.zip 0bbac0106358dc99b8ba2401ae6a1c10d3927ca9
Unzipping :prebuilt_downloads\SDL2-devel-2.0.10-VC.zip:
Downloading... https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip 137f86474691f4e12e76e07d58d5920c8d844d5b
Unzipping :prebuilt_downloads\SDL2_image-devel-2.0.5-VC.zip:
Downloading... https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.14-VC.zip c64d90c1f7d1bb3f3dcfcc255074611f017cdcc4
Unzipping :prebuilt_downloads\SDL2_ttf-devel-2.0.14-VC.zip:
Downloading... https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip 9097148f4529cf19f805ccd007618dec280f0ecc
Unzipping :prebuilt_downloads\SDL2_mixer-devel-2.0.4-VC.zip:
Downloading... https://www.ijg.org/files/jpegsr9c.zip 9ca086c960ffc4bff821ba194c8d0a15f69eae09
Unzipping :prebuilt_downloads\jpegsr9c.zip:
Downloading... https://bitbucket.org/llindstrom/pygame/downloads/prebuilt-x64-pygame-1.9.2-20150922.zip 3a5af3427b3aa13a0aaf5c4cb08daaed341613ed
---
For help with compilation see:
https://www.pygame.org/wiki/CompileWindows
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\User\AppData\Local\Temp\pip-install-ccq77zry\pygame\
here:
https://github.com/googleapis/google-cloud-python/issues/3884
I found the advice to use:
pip install --upgrade setuptools
witch lead to:
Collecting setuptools
Downloading
https://files.pythonhosted.org/packages/6d/ed/52e05469314a266f68d9f251a8c1ab7a21a03327b1724056e3eea654bfd1/setuptools-50.0.3-py3-none-any.whl (784kB)
100% |████████████████████████████████| 788kB 1.2MB/s
Installing collected packages: setuptools
Found existing installation: setuptools 40.8.0
Uninstalling setuptools-40.8.0:
Could not install packages due to an EnvironmentError: [WinError 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: 'd:\\workspace\\pycharmprojects\\libs5\\testproject\\venv\\lib\\site-packages\\setuptools-40.8.0-py3.8
.egg'
Consider using the `--user` option or check the permissions.
so i tried:
pip install --upgrade setuptools --user
witch worked:
Collecting setuptools
Using cached
https://files.pythonhosted.org/packages/6d/ed/52e05469314a266f68d9f251a8c1ab7a21a03327b1724056e3eea654bfd1/setuptools-50.0.3-py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-50.0.3
sadly this did not change the Error message.

Pip install openslide completes successfully but when I import it "the specified module is not found"

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.

Completely confused by PyCharm environments

I managed to install an OpenAI gym Atari environment in a PyCharm project. (It took so much trial and error that I no longer know what finally got it to work. But now it does.)
I copied the project directory, created another project from the copy, and tried to run the same program that ran before -- actually the copy of the program that was created when I copied the directory. Now I get an error message saying that the Atari environment is not installed -- or not installed correctly.
Traceback (most recent call last):
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\gym\envs\atari\atari_env.py", line 9, in <module>
import atari_py
ModuleNotFoundError: No module named 'atari_py'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/rabbott/Google Drive/CSULA/ECST/CS Dept/CS 4660/2018/OpenAI_Models/Q-Learning-Framework - Copy/Interactive_Atari-2018-10-27-2230.py", line 416, in <module>
GameControl(Bot()).play('Pong-v0')
File "C:/Users/rabbott/Google Drive/CSULA/ECST/CS Dept/CS 4660/2018/OpenAI_Models/Q-Learning-Framework - Copy/Interactive_Atari-2018-10-27-2230.py", line 30, in play
env = gym.make(game)
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\gym\envs\registration.py", line 167, in make
return registry.make(id)
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\gym\envs\registration.py", line 119, in make
env = spec.make()
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\gym\envs\registration.py", line 85, in make
cls = load(self._entry_point)
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\gym\envs\registration.py", line 14, in load
result = entry_point.load(False)
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2324, in load
return self.resolve()
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2330, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\gym\envs\atari\__init__.py", line 1, in <module>
from gym.envs.atari.atari_env import AtariEnv
File "C:\Users\rabbott\AppData\Local\Programs\Python\Python37\lib\site-packages\gym\envs\atari\atari_env.py", line 11, in <module>
raise error.DependencyNotInstalled("{}. (HINT: you can install Atari dependencies by running 'pip install gym[atari]'.)".format(e))
gym.error.DependencyNotInstalled: No module named 'atari_py'. (HINT: you can install Atari dependencies by running 'pip install gym[atari]'.)
Process finished with exit code 1
When I try to install it again, I run into the same problems I had originally. In particular, I have no idea what will get the Atari environment installed correctly.
Is there some relatively easy and straightforward way to use the installation that already works in the copy of the project?
Thanks.
Safest way to install gym and work without any issue is by using a python virtual environment. It is always better to have a separate virtual environment for your gym projects. Please use conda or pipenv to create a virtual environment.
Example in pipenv
install pipenv
pip install --user pipenv
go inside your project directory ( where your .py file resides )
cd myproject
install gym
pipenv install gym
install atari and any other dependency in your virtual environment as follows.
pipenv install atari-py
run your code
pipenv run python main.py
This will make sure your code work without any issue.
NOTE
Pipenv creates different virtual environments for each project. If you want to use the same environment for multiple projects use virtual environments in conda as mentioned above.

Issues installing pywin32 behind proxy

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?

Resources