Skip to content
Sign upLog in
← Back to Community
How come PyQt5 can't import?
Profile icon
UniqueOstrich18

How come PyQt5 can't import? I've installed it, but it gives an error when I try to import it. (look in "program.py")

The error:
ImportError: No module named PyQt5

Voters
Profile icon
artiemsirotkin
Profile icon
mannixchiweshe
Profile icon
UniqueOstrich18
Comments
hotnewtop
Profile icon
HackermonDev

You have to use python 3.

Profile icon
UniqueOstrich18

@PDanielY
Yeah I tried that.

Profile icon
HackermonDev

@UniqueOstrich18
i don't think you did. When i forked your project then changed it to from python2 to python3 it worked

Profile icon
UniqueOstrich18

@PDanielY
Ok. It still doesn't work.
image

Profile icon
HackermonDev

@UniqueOstrich18
oh, maybe trying to create a python 2 repl can putting the contents of program.py in it

Profile icon
UniqueOstrich18

@PDanielY
So you want me to create a python 2 repl with the contents of program.py in it? I did that and it gave me this error:
image

Also, can you upvote this post at https://repl.it/talk/learn/My-Methods-to-Bypass-School-Filters/30421? I put a lot of effort into it.

Profile icon
HackermonDev

@UniqueOstrich18
yes and i am trying one of the things on it if it works i'll upvote the post

Profile icon
UniqueOstrich18

@PDanielY
Ok thanks!

Profile icon
HackermonDev

@UniqueOstrich18
the libary only works with python 3 so create a python 3 repl and make sure the code is compatible for python 3 and run it

Profile icon
UniqueOstrich18

@PDanielY
Ok, I'll try that.
I just got this error:

Repl.it: Updating package configuration --> /usr/local/bin/python3 -m poetry init --no-interaction This command will guide you through creating your pyproject.toml config. --> /usr/local/bin/python3 -m poetry add pyqt5 Using version ^5.14 for pyqt5 Updating dependencies Resolving dependencies... Writing lock file Package operations: 2 installs, 0 updates, 0 removals - Installing pyqt5-sip (12.7.1) - Installing pyqt5 (5.14.1) [EnvCommandError] Command ['/home/runner/.local/share/virtualenvs/python3/bin/python', '-m', ' pip', 'install', '--no-deps', 'pyqt5==5.14.1'] errored with the following ou tput: Collecting pyqt5==5.14.1 Downloading https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d 8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz (3.2MB) Installing build dependencies: started Installing build dependencies: still running... Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing wheel metadata: started Preparing wheel metadata: finished with status 'error' ERROR: Command errored out with exit status 1: command: /home/runner/.local/share/virtualenvs/python3/bin/python /home /runner/.local/share/virtualenvs/python3/lib/python3.8/site-packages/pip/_ve ndor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmph47y07nb cwd: /tmp/pip-install-d_ulotod/pyqt5 Complete output (31 lines): Traceback (most recent call last): File "/home/runner/.local/share/virtualenvs/python3/lib/python3.8/site -packages/pip/_vendor/pep517/_in_process.py", line 64, in prepare_metadata_f or_build_wheel hook = backend.prepare_metadata_for_build_wheel AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata _for_build_wheel' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/runner/.local/share/virtualenvs/python3/lib/python3.8/site -packages/pip/_vendor/pep517/_in_process.py", line 207, in <module> main() File "/home/runner/.local/share/virtualenvs/python3/lib/python3.8/site -packages/pip/_vendor/pep517/_in_process.py", line 197, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/runner/.local/share/virtualenvs/python3/lib/python3.8/site -packages/pip/_vendor/pep517/_in_process.py", line 66, in prepare_metadata_f or_build_wheel return _get_wheel_metadata_from_wheel(backend, metadata_directory, File "/home/runner/.local/share/virtualenvs/python3/lib/python3.8/site -packages/pip/_vendor/pep517/_in_process.py", line 95, in _get_wheel_metadat a_from_wheel whl_basename = backend.build_wheel(metadata_directory, config_settin gs) File "/tmp/pip-build-env-iszp3_46/overlay/lib/python3.8/site-packages/ sipbuild/api.py", line 51, in build_wheel project = AbstractProject.bootstrap('pep517') File "/tmp/pip-build-env-iszp3_46/overlay/lib/python3.8/site-packages/ sipbuild/abstract_project.py", line 82, in bootstrap project.setup(pyproject, tool, tool_description) File "/tmp/pip-build-env-iszp3_46/overlay/lib/python3.8/site-packages/ sipbuild/project.py", line 387, in setup self.apply_user_defaults(tool) File "project.py", line 62, in apply_user_defaults super().apply_user_defaults(tool) File "/tmp/pip-build-env-iszp3_46/overlay/lib/python3.8/site-packages/ pyqtbuild/project.py", line 86, in apply_user_defaults super().apply_user_defaults(tool) File "/tmp/pip-build-env-iszp3_46/overlay/lib/python3.8/site-packages/ sipbuild/project.py", line 202, in apply_user_defaults self.builder.apply_user_defaults(tool) File "/tmp/pip-build-env-iszp3_46/overlay/lib/python3.8/site-packages/ pyqtbuild/builder.py", line 67, in apply_user_defaults raise PyProjectOptionException('qmake', sipbuild.pyproject.PyProjectOptionException ---------------------------------------- ERROR: Command errored out with exit status 1: /home/runner/.local/share/vir tualenvs/python3/bin/python /home/runner/.local/share/virtualenvs/python3/li b/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata _for_build_wheel /tmp/tmph47y07nb Check the logs for full command output. WARNING: You are using pip version 19.2.3, however version 20.0.2 is availab le. You should consider upgrading via the 'pip install --upgrade pip' command. add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)... exit status 1 Repl.it: Package operation failed.
Profile icon
UniqueOstrich18

@PDanielY
got an error

Profile icon
CoderRudra

@UniqueOstrich18
bruh have you tried pip installing?