Why can't I install PyQt5 from the pypi? - python

I want to use PyQt5 in pycharm. After trying to install the package from Available packages, an error says: 'Install packages failed: Error occurred when installing package PyQt5.'
The complete log is here:
------------------------------------------------------------
C:\Program Files (x86)\JetBrains\PyCharm 3.0.1\helpers\packaging_tool.py run on 02/05/14 16:13:23
Downloading/unpacking PyQt5
Getting page https://pypi.python.org/simple/PyQt5/
URLs to search for versions for PyQt5:
* https://pypi.python.org/simple/PyQt5/
Analyzing links from page https://pypi.python.org/simple/PyQt5/
Could not find any downloads that satisfy the requirement PyQt5
No distributions at all found for PyQt5
Exception information:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\basecommand.py", line 139, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\commands\install.py", line 266, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py", line 1026, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\index.py", line 171, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for PyQt5
What should I do?
This is what I've done is this:
Installed Python 3.3 and added to PATH
Installed PyQt5-5.2-gpl-Py3.3-Qt5.2.0-x64.exe
And I don't know how to use PyQt in pycharm.
can you provide more information?

AFAIK, you cannot install PyQt4/PyQt5 from PyPI. You would have to install it separately.
If you see this link, you can see that there are no listed packages for PyQt5 (likewise for PyQt4) on PyPI. So, you would need to download the installer separately from here and install it.
That is what the
DistributionNotFound: No distributions at all found for PyQt5
refers to.
[UPDATE]: You'll also most likely need to install sip the same way, here's how: https://askubuntu.com/a/666336/12214

FYI, installing QtPy5 with pip works in 3.6.5. According to https://www.riverbankcomputing.com/software/sip/download even 3.5 and later.

Related

Error when trying to upgrade a python package

I have git pulled a python package (I think that is the correct terminology) that I already had installed and working.
So now it is up to date, apparently I needed to update it using pip. I did the following:
pip install the_package --upgrade
But I got the following error message:
Exception:
Traceback (most recent call last):
File "/opt/work/python/2.7.13/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/opt/work/python/2.7.13/lib/python2.7/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/opt/work/python/2.7.13/lib/python2.7/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/opt/work/python/2.7.13/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/opt/work/python/2.7.13/lib/python2.7/site-packages/pip/req/req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "/opt/work/python/2.7.13/lib/python2.7/site-packages/pip/utils/packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "/opt/work/python/2.7.13/lib/python2.7/email/feedparser.py", line 177, in feed
self._input.push(data)
File "/opt/work/python/2.7.13/lib/python2.7/email/feedparser.py", line 99, in push
parts = data.splitlines(True)
AttributeError: 'NoneType' object has no attribute 'splitlines'
I'm not sure what the problem is. Could someone please point me in the right direction?
I can't say much about the error you're seeing, but my best guess is that the version of the package from git is interfering with the pip installed one. Perhaps something went wrong when trying to upgrade starting with the gitHub version (or wherever it came from) and not with an officially published one.
If a package is available through PyPI you shouldn't need to do anything besides pip install <somepackage>. I would recommend removing all files downloaded via git and those modules in your python lib so you can start over completely. From there just use pip install <packagename>.
If you're not already in a python virtual environment I would recommend creating one too, so that these things are easier to fix.
Edit: I just found elsewhere on this site that you can use pip show <packagename> to show the install location of the package if you're not in a venv (or if you are).

Exception using mock library, python unit testing issue

Windows 7 Professional (64 bit)
Python 2.7.14 (2.7.14150 64 bit)
mock 2.0.0
When I just run python -c "import mock" from command prompt (as an administrator) it yields Exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\site-packages\mock\__init__.py", line 2, in <module>
import mock.mock as _mock
File "C:\Python27\lib\site-packages\mock\mock.py", line 71, in <module>
_v = VersionInfo('mock').semantic_version()
File "C:\Python27\lib\site-packages\pbr\version.py", line 461, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File "C:\Python27\lib\site-packages\pbr\version.py", line 448, in _get_version_from_pkg_resources
result_string = packaging.get_version(self.package)
File "C:\Python27\lib\site-packages\pbr\packaging.py", line 755, 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 t
o pbr.version.VersionInfo. Project name mock was given, but was not able to be found.
The answer is in the exception message at the end: 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 mock was given, but was not able to be found.
This seems to be an issue with pbr package. Have you tried to reinstall it or remove it to test if this fixes the issue (which would indicate you need to concetrate on pbr)?
I had the same issue and in my case updating setuptools was the fix.
I've found the suggestion here:
https://github.com/testing-cabal/mock/issues/314
Before update I had setuptools 0.6c11 and I've updated to latest 39.2.0.
pip install --upgrade setuptools
or actually in my case I had to download and install locally since production server has no connection to internet:
pip download setuptools
pip install setuptools-39.2.0-py2.py3-none-any.whl

How to fix ".dist-info directory not found" in my package?

I have a Python 2 package that I'm trying to upgrade to Python 3. It was written by someone who used to work on the same team I'm on now but who is no longer with the company, and unfortunately nobody left on the team is able to help out.
After running 2to3 on the files of the package, I ran python setup.py sdist to create a package, placed the package in a local repository, then attempted to use pip install to install the package. It ended up erroring out with the following:
Exception:
Traceback (most recent call last):
File "/home/user/project/lib/python3.5/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/home/user/project/lib/python3.5/site-packages/pip/commands/install.py", line 297, in run
root=options.root_path,
File "/home/user/project/lib/python3.5/site-packages/pip/req/req_set.py", line 622, in install
**kwargs
File "/home/user/project/lib/python3.5/site-packages/pip/req/req_install.py", line 808, in install
self.move_wheel_files(self.source_dir, root=root)
File "/home/user/project/lib/python3.5/site-packages/pip/req/req_install.py", line 1003, in move_wheel_files
isolated=self.isolated,
File "/home/user/project/lib/python3.5/site-packages/pip/wheel.py", line 340, in move_wheel_files
assert info_dir, "%s .dist-info directory not found" % req
AssertionError: my-package-name .dist-info directory not found
The old Python 2 version of the package didn't have anything called .dist-info in the .tgz archive, and it installed just fine. Does anyone know what's going on here and how to fix it?
In my case this was resolved by deleting AppData\Local\pip\Cache folder (windows). Should be fairly similar for other operating systems.

Download URL for PyPi Package

I am written a small package and have successfully uploaded the package to pypi but when i do to install using pip, this traceback comes and it never gets installed.
Downloading/unpacking pytransmit
Getting page https://pypi.python.org/simple/pytransmit/
URLs to search for versions for pytransmit:
* https://pypi.python.org/simple/pytransmit/
Analyzing links from page https://pypi.python.org/simple/PyTransmit/
Could not find any downloads that satisfy the requirement pytransmit
Cleaning up...
Removing temporary dir c\temp\pip_build_dd...
No distributions at all found for pytransmit
Exception information:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 270, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1157, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "C:\Python27\lib\site-packages\pip\index.py", line 285, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for pytransmit
How shall i make it installable using pip.
You don't have any files to download. You can follow the official tutorial and upload your package files.
Essencially you need to register your package first -
python setup.py register
and then upload the distributables -
python setup.py sdist bdist_wininst upload

Installing ScientificPython as a dependency

I am trying to list ScientificPython as a dependency in my setup.py. However, during the installation process, python seems to not find the package. What is wrong in my approach?
Here is my setup:
import setuptools
setuptools.setup(name = 'MyPack', version = '0.1',
description= 'Description.',
author = 'Me',
packages = setuptools.find_packages(),
install_requires = ['ScientificPython'],
dependency_links = ["https://sourcesup.cru.fr/frs/?group_id=180&release_id=1351#stable-releases-2-8-title-content"])
And this is the important part of the output when I run python setup.py install:
Processing dependencies for MyPack==0.1
Searching for ScientificPython
Reading https://sourcesup.cru.fr/frs/?group_id=180&release_id=1351#stable-releases-2-8-title-content
Download error: unknown url type: https -- Some packages may not be found!
Reading http://pypi.python.org/simple/ScientificPython/
Reading http://dirac.cnrs-orleans.fr/ScientificPython/
Reading http://starship.python.net/~hinsen/ScientificPython/
No local packages or download links found for ScientificPython
Best match: None
Traceback (most recent call last):
File "setup.py", line 22, in <module>
dependency_links = ["https://sourcesup.cru.fr/frs/?group_id=180&release_id=1351#stable-releases-2-8-title-content"])
File "/home/woltan/local/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/home/woltan/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/home/woltan/local/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 76, in run
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 104, in do_egg_install
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 211, in run
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 427, in easy_install
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 478, in install_item
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 519, in process_distribution
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 563, in resolve
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 799, in best_match
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 811, in obtain
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 434, in easy_install
File "/home/woltan/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/package_index.py", line 475, in fetch_distribution
AttributeError: 'NoneType' object has no attribute 'clone'
Maybe one issue is, that ScientificPython is somehow not accessible though PyPI, or at least not downloadable as easy_install ScentificPython will fail with No local packages or download links found for ScentificPython.
What do I need to do in order to install ScientificPython with setuptools?
Have you tried putting the direct download link (https://sourcesup.cru.fr/frs/download.php/2309/ScientificPython-2.8.tar.gz) into the dependency_links rather than the html page as your script seems not to find the package and then tries to install None.
edit: just noticed: python apparently is not able to open https resources - try uploading it somewhere without https, using normal http
edit 2: Why don't you just put the whole ScientificPython folder into your distribution folder and make sure its setup.py (or whatever else you need to call) is called by your setup.py?
The problem is specifically that its trying to make an http connection to a https site. From what I can tell setuptools does not support connections to https. You're going to have to use another method for getting those packages.
My recommendation, if you want to use setuptools, is that you detail in the README for the file that they have to download that dependency and install it and then have the dependency in the setuptools that fails to the install if they don't have it.
Python is unable to handle https protocol, install openssl-devel package and reinstall the python to fix this.
I was getting similar error when installing MyProxyClient using easy_install:
"Download error: unknown url type: https -- Some packages may not be found!"
and other errors about not finding openssl headers.
So installing libssl-dev (on Ubuntu) solved the problem for me!

Categories

Resources