Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named 'sipdistutils' #14

Closed
ghost opened this issue Mar 21, 2017 · 22 comments
Closed

ImportError: No module named 'sipdistutils' #14

ghost opened this issue Mar 21, 2017 · 22 comments

Comments

@ghost
Copy link

ghost commented Mar 21, 2017

On Ubuntu 16.04LTS in a virtualenv, building python-poppler-qt5 fails:

$ cd python-poppler-qt5
$ python3.5 setup.py build
Traceback (most recent call last):
  File "setup.py", line 42, in <module>
    import sipdistutils
ImportError: No module named 'sipdistutils'

But sip is installed:

$ pip3 freeze | grep sip
sip==4.19.1

What am I missing?

@syntaxaire
Copy link

The same problem is preventing me from even pip installing python-poppler-qt5.
Running this in a venv called 'frescobaldi' with sip installed:

(frescobaldi) syntaxaire@ubuntu:~/Python/frescobaldi$ python --version
Python 3.6.1
(frescobaldi) syntaxaire@ubuntu:~/Python/frescobaldi$ pip list
pip (9.0.1)
PyQt5 (5.8.2)
python-ly (0.9.5)
setuptools (28.8.0)
sip (4.19.2)
(frescobaldi) syntaxaire@ubuntu:~/Python/frescobaldi$ pip install python-poppler-qt5
Collecting python-poppler-qt5
  Using cached python-poppler-qt5-0.24.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-60rugen8/python-poppler-qt5/setup.py", line 42, in <module>
        import sipdistutils
    ModuleNotFoundError: No module named 'sipdistutils'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-60rugen8/python-poppler-qt5/```

@chamcha
Copy link

chamcha commented May 28, 2017

i also have the same issue.

i hope this problem will be fix soon.

@francescpuig7
Copy link

francescpuig7 commented May 29, 2017

I see that the issue remains open, and I have the same error on Windows 10 x64

My environment:

Python 3.6
PyQt5==5.7.1
Sip= 4.9.12

Were able to solve this problem?

@jcnengel
Copy link

You might want to consider installing the development package for python-sip. This is required for building.

@tmattio
Copy link

tmattio commented Jul 25, 2017

It seems like the pip version of sip does not install sipdistutils. To install it from source, you can do that:

wget https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.3/sip-4.19.3.tar.gz
tar zxvf sip-4.19.3.tar.gz
cd sip-4.19.3
python configure.py
make
make install

@s-m-e
Copy link

s-m-e commented Aug 17, 2017

You can get the sipdistutils.py from riverbank's mercurial server, i.e. from here. It is self-contained. Just place it into your Python site-packages folder ...

@sincere-music
Copy link

This issue is driving me nuts, TBH. I followed the suggestion in the last comment, but it doesn’t change anything about the error message from Frescobaldi:

~$ frescobaldiTraceback (most recent call last):
  File "/usr/local/bin/frescobaldi", line 7, in <module>
    import main
  File "/usr/local/lib/python3.6/site-packages/frescobaldi_app/main.py", line 25, in <module>
    import sip
ModuleNotFoundError: No module named 'sip'

@ghost
Copy link

ghost commented Oct 22, 2017

sincere-music, are you installing sip to python2 by any chance? Unless your default python is 3.x, you have to replace 'python' by python3 in tmattio's instructions.

@sincere-music
Copy link

sincere-music commented Oct 22, 2017

Thanks ccmaass, that really got me a large step forward.
Unfortunately, after that step I’m still not at the goal:

~$ frescobaldi
Traceback (most recent call last):
  File "/usr/local/bin/frescobaldi", line 7, in <module>
    import main
  File "/usr/local/lib/python3.6/site-packages/frescobaldi_app/main.py", line 33, in <module>
    from PyQt5.QtCore import QSettings, QTimer, QUrl
ModuleNotFoundError: No module named 'PyQt5'
~$ sudo -H pip3 install pyqt5
Collecting pyqt5
  Downloading PyQt5-5.9-5.9.1-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl (104.6MB)
    100% |████████████████████████████████| 104.6MB 9.5kB/s 
Collecting sip<4.20,>=4.19.3 (from pyqt5)
  Downloading sip-4.19.3-cp35-cp35m-manylinux1_x86_64.whl (63kB)
    100% |████████████████████████████████| 71kB 1.3MB/s 
Installing collected packages: sip, pyqt5
  Found existing installation: sip 4.19.2
    Uninstalling sip-4.19.2:
      Successfully uninstalled sip-4.19.2
Successfully installed pyqt5-5.9 sip-4.19.3
~$ frescobaldi
Traceback (most recent call last):
  File "/usr/local/bin/frescobaldi", line 7, in <module>
    import main
  File "/usr/local/lib/python3.6/site-packages/frescobaldi_app/main.py", line 33, in <module>
    from PyQt5.QtCore import QSettings, QTimer, QUrl
ModuleNotFoundError: No module named 'PyQt5'

How should I go about to make Python 3.6 find PyQt5?

@sincere-music
Copy link

Some more chapters to the story: I noticed that pip wasn’t at the most recent version, and after an awful many turns (including recompiling python3.6 to circumvent an issue with zlib – I can’t believe those things are so convoluted…) I have a python3.6 and matching pip that seem to work fine…
… except:

~$ frescobaldi
Traceback (most recent call last):
  File "/usr/local/bin/frescobaldi", line 4, in <module>
    from frescobaldi_app import toplevel
ModuleNotFoundError: No module named 'frescobaldi_app'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/local/bin/frescobaldi", line 4, in <module>
    from frescobaldi_app import toplevel
ModuleNotFoundError: No module named 'frescobaldi_app'

@sincere-music
Copy link

I did find this: https://stackoverflow.com/questions/45012581/how-to-import-python3-lib-in-python3-6, but the virtual environment part doesn’t apply to my use case at all.

@sincere-music
Copy link

sincere-music commented Dec 26, 2017

Finally, I compiled a reliable way to install frescobaldi with all its dependencies (except for MIDI support) on Ubuntu 16.04:

sudo apt update
sudo apt install python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebkit
cd ~
wget https://pypi.python.org/packages/01/ca/e86c73614a690d778ec9831adee0a728a495f4fb717fab263b5e4887b086/python-ly-0.9.5.tar.gz
tar -xzf python-ly-0.9.5.tar.gz
rm python-ly-0.9.5.tar.gz
cd python-ly-0.9.5
sudo python3 setup.py install
cd ..
wget --show-progress https://github.com/wbsoft/frescobaldi/releases/download/v3.0.0/frescobaldi-3.0.0.tar.gz
tar -xzf frescobaldi-3.0.0.tar.gz
rm frescobaldi-3.0.0.tar.gz
cd frescobaldi-3.0.0
sudo python3 setup.py install
cd ..
sudo apt install libpoppler-qt5-1
wget http://de.archive.ubuntu.com/ubuntu/pool/universe/p/python-poppler-qt5/python3-poppler-qt5_0.24.2-1build1_amd64.deb
sudo dpkg -i python3-poppler-qt5_0.24.2-1build1_amd64.deb

@fedelibre
Copy link
Member

You can get the sipdistutils.py from riverbank's mercurial server, i.e. from here. It is self-contained. Just place it into your Python site-packages folder ...

I confirm it works. Here's a two commands example:

wget https://www.riverbankcomputing.com/hg/sip/raw-file/tip/sipdistutils.py
cp sipdistutils.py .virtualenvs/frescobaldi/lib/python3.6/site-packages/

@fedelibre
Copy link
Member

sipdistutils.py has been removed from the sip repository as part of legacy stuff.

It should now be downloaded from here:

wget https://www.riverbankcomputing.com/hg/sip/raw-file/79f89221765d/sipdistutils.py

@fedelibre
Copy link
Member

IIUC, SIP v5 should fix this problem, see this message from a Riverbank developer two months ago:
http://python.6.x6.nabble.com/SIP-sipdistutils-py-not-installed-td5252485.html

@AiyionPrime
Copy link

Well, welcome to 2020 everyone.
Installing this in a virtualenv still breaks -.-'

@davidecappellaro
Copy link

Well, welcome to 2020 everyone.
Installing this in a virtualenv still breaks -.-'

I recently successfully managed it working by using colab notebook by google and

!apt-get install python3-poppler-qt5
import popplerqt5

@seth4618
Copy link

seth4618 commented Jul 4, 2020

This bug still exists if you follow the pip install route, but it does work via the apt-get route. tested on ubuntu 18.04

@Aens
Copy link

Aens commented Jul 19, 2020

This bug happens on Python 3.8 and Windows 10, and I'm not even using a virtualenv to install it. Fails both through PyCharm and CMD

@lbartoletti
Copy link

sipdistuils has been removed from sip5. Any works on this issue?

@coder202
Copy link

Well, welcome to 2020 everyone.
Installing this in a virtualenv still breaks -.-'

I recently successfully managed it working by using colab notebook by google and

!apt-get install python3-poppler-qt5
import popplerqt5

On Fedora it's:
sudo dnf install python3-poppler-qt5

@jeanas
Copy link
Member

jeanas commented Aug 9, 2023

This issue is outdated; we don't use the legacy sipdistutils anymore.

@jeanas jeanas closed this as completed Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests