I ran the Anaconda Launcher (Windows 7) and clicked "Update" next to each thing, and now Spyder doesn't work. It pops up this error message:
---------------------------
Spyder
---------------------------
Please check Spyder installation requirements:
PyQt4 4.6+ (or PySide 1.2.0+) is required.
---------------------------
OK
---------------------------
but that's already met:
>conda update pyqt
Fetching package metadata: ....
# All requested packages already installed.
# packages in environment at C:\Users\Jonathan\Anaconda:
#
pyqt 4.11.4 py27_0
I don't understand the problem.
There appears to be a bug that the Anaconda developers are working on. It was brought up here.
https://groups.google.com/a/continuum.io/forum/#!msg/anaconda/DM3pbxrb_ps/llEAnH00DwAJ
Your best choice is to downgrade PyQT4 until it is fixed. Just run the following command.
conda install pyqt=4.10
Related
Unsing Spyder I receive the following error when starting the IDE:
Python 3.7.15 (default, Nov 24 2022, 21:12:53)
Type "copyright", "credits" or "license" for more information.
IPython 7.31.1 -- An enhanced Interactive Python.
An error ocurred while starting the kernel
Unable to load extension: pydevd_plugins.extensions.types.pydevd_plugin_pandas_types
What is the cause and how to fix this issue?
* Spyder version: 5.3.3 (conda)
* Python version: 3.7.15 64-bit
* Qt version: 5.15.2
* PyQt5 version: 5.15.7
* Operating System: Linux 4.19.0-5-amd64
I face the same probelm ,my solution was updating spyder to latest version that is 5.4.2 and activate conda environment that you set in spyder and run conda install spyder-kernels=2.4 again.hope this help
The UnsatisfiableError error message typically indicates that the package you are trying to install (in this case, spyder-kernels=2.4) has a dependency that conflicts with another package or version of Python already installed in your environment.
Here are a few things you can try to resolve the issue:
Make sure you have activated the correct conda environment before running the conda install command. You can do this by running conda activate <env_name> in your terminal or Anaconda prompt.
1.Try updating your existing packages before installing spyder-kernels=2.4. You can do this by running conda update --all in your terminal or Anaconda prompt.
2.Try creating a new conda environment specifically for Spyder and its dependencies. You can create a new environment with the necessary Python version and install Spyder and other packages using the following commands:
conda create -n spyder_env python=3.8
conda activate spyder_env
conda install spyder=5.0
This will create a new environment called spyder_env with Python 3.8 and install Spyder 5.0.
3.If none of the above works, try removing the existing environment and creating a new one from scratch. You can remove an environment with the command conda remove --name <env_name> --all. Just be aware that this will remove all packages and dependencies in the environment.
Hopefully one of these solutions will help resolve the UnsatisfiableError you're seeing.
I had OpenCV working fine with PyCharm CE and Python 3.8. Then I upgraded the Mac OS to Big Sur and it stopped working. I reinstalled OpenCV as follows with no effect:
pip3 install opencv-python
pip3 install opencv-contrib-python
I found that the solution was to downgrade the opencv version. In Pycharm, the process is as follows:
In Preferences, go to Python interpreter. You will see the current versions of opencv-contrib-python and opencv-python which may be the same as the latest version.
That is the problem.
Double click on the current version of opencv-contrib-python to open this screen:
Check the specify version checkbox and find version 4.1.2.30. Then click Install Package and wait a few seconds to get a message that package was successfully installed. Press OK and you should see opencv-conbtrib-python downgraded to the appropriate version.
After step 3, opencv-python may have also downgraded to the appropriate version 4.2.0.34. If it hasn't, follow the same process to downgrade opencv-python to 4.2.0.34. At the end, your python interpreter screen should look like this:
That should do it. Test it to make sure it works.
I recently bought a new macbook and I've been trying endlessly to get pygame to work, but haven't succeeded yet. I'm getting pretty desperate and I could really use some help.
I've installed pygame 1.9.4 and even though I don't get any error messages when running pygame code, it won't show me anything but a blank screen. I'm using the following code to test it:
import pygame
pygame.init()
screen = pygame.display.set_mode((800,600))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
screen.fill((255,0,0))
pygame.display.update()
pygame.quit()
On my old macbook the test code gives me a red screen as expected. Both macbooks are running python 2.7.10.
Does anyone have any idea what I'm doing wrong? I think I installed pygame exactly like I did on my old macbook and the only difference seems to be the operating system.
edit 1:
I write the script in Sublime Text and run the program in Terminal.
Screenshot
edit 2:
I got pygame working again by downgrading my operating system to macOS High Sierra.
Tested and works on macOS 10.15 Catalina, Python 3.7.5, PyGame 2.0.0 (pre-release as of this writing) and PyGame 1.9.6 (stable as of this writing).
Initially you need to decide if you want a stable release or a pre-release (unstable). If you decide to use the latest (and possibly pre-release/unstable) then just ignore the first step ("1. Find the latest stable release version") and use master branch at step 4 of the second step ("2. Install PyGame from source").
1. Find the latest stable release version
Go to PyGame's GitHub page here:
As you can see as of this writing the latest stable release is 1.9.6 so we hold this tag name for later.
2. Install PyGame on macOS from source
Install some dependencies brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf. This requires homebrew.
Go to site-packages:
For virtual environment go to cd ~/.virtualenvs/myvirtualenv/lib/python3.X/site-packages where ~/.virtualenvs/myvirtualenv is the path to your virtual environment and python3.X is the version of your Python.
For system-wide installation go to /usr/local/lib/python3.X/site-packages where python3.X is the version of your Python.
Delete any previous pygame, pip uninstall pygame (if a pygame directory exists in site-packages then remove it: rm -rf pygame*)
Clone PyGame from GitHub:
git clone https://github.com/pygame/pygame.git for the latest (possibly not stable version).
git clone -b 1.9.6 https://github.com/pygame/pygame.git --single-branch for the latest (1.9.6 is the tag name of the latest stable release, as of this writing, see "Find the latest stable release version above")
Go into the newly cloned pygame directory: cd pygame.
Run python setup.py --config --auto --sdl2.
If you get problems with this command, some users below mentioned that single hyphens worked for them, therefore try: python setup.py -config -auto -sdl2.
If you get any problems regarding Python2/3 and you are targeting Python3 try to change python setup.py --config --auto --sdl2 to python3 setup.py --config --auto --sdl2.
Run python setup.py install (it will take a while).
If you get any problems regarding Python2/3 and you are targeting Python3 try to change python setup.py --config --auto --sdl2 to python3 setup.py --config --auto --sdl2.
Now PyGame should work as expected on macOS.
I also face this problem on the macOS Catalina. Actually it is a version problem of pygame. Firstly I have installed with the following command:
pip3 install pygame
An only blank screen was showing. But later on, I have changed the version with the following command:
pip3 install pygame==2.0.0.dev4
With this version my problem was solved. It was working perfectly.
LATEST UPDATE for MacOS 10.14.1
If you download the official macOS x64 installer package of Python 3.7.2 from the official python.org page and type pip3 install pygame, it works.
There's an issue with MacOS. It should be possible to fix in SDL.
https://discourse.libsdl.org/t/macos-10-14-mojave-issues/25060/8
https://bugzilla.libsdl.org/show_bug.cgi?id=4274
The pygame issue is here: https://github.com/pygame/pygame/issues/555
The homebrew issue is here: https://github.com/Homebrew/homebrew-core/issues/33016
I ran into this issue using macOS Catalina version 10.15.2, Python 3.7.2 and pygame 1.9.6. I upgraded to Python 3.8.1, Pygame 2.0.0.dev6 and it is now working as expected.
I tried upgrading my old macbook to OS Mojave to see if pygame would stop working, and it did!
I guess Mojave isn't compatible with pygame (yet).
Thanks for the help!
Edit with working workaround:
see bottom of post
I get the same problem on a MacBook Pro (Retina display) with python3.7 and MacOs Mojave.
For the sake of simplicity, I did all my tests with your exact same code and pygame 1.9.4.
On (two) Windows computers, the program works and shows a red window on :
python2.7
python3.6
python3.7
Hence it doesn't seem to be a Python version problem, I lean toward a MacOS Mojave problem.
Mojave introduced 'Dark mode' which automatically tint windows. When dark mode is disabled, I get a blank screen. When it is enabled, I get a dark screen. Might it be that MacOS takes control of the screen display and fiddles with the way pygame controls the screen? It is just a theory but I don't know how to test it.
Edit:
I tried a pygame program that records and prints the position of the screen on which you clicked. It does output the position in the console, alas it doesn't display anything.
Apart from the faulty display, pygame seems to work properly.
Edit:
For now, using the Python version from miniconda and using CogSci's pygame seems to work.
I've tried everything but nothing worked except this:
pip install git+https://github.com/pygame/pygame.git
This installs the tips of the pygame. It worked for me. Give it a try.
I ran into this problem with the following environment: Python 3.7, Mojave 10.14.2, Pygame 1.9.4
I found that downgrading to Python 3.6 fixes the issue
$ brew unlink python
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
That should fix it, if you get a circular dependency problem you should then run:
$ brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
Details at https://apple.stackexchange.com/questions/329187/homebrew-rollback-from-python-3-7-to-python-3-6-5-x
I had the same issue, got it to work by downgrading python to 3.6.5.
> brew unlink python brew install --ignore-dependencies
> https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
> brew switch python 3.6.5_1 pip3 install pygame
If you already have python 3.6.5 install I guess you can just use switch.
Some macs need updates. If you go to system preferences and you go to software updates, you could try updating to see if it needs any updates. When you update, you can check to see if your code works now because it looks like your code is correct.
I recently bought a new macbook and I've been trying endlessly to get pygame to work, but haven't succeeded yet. I'm getting pretty desperate and I could really use some help.
I've installed pygame 1.9.4 and even though I don't get any error messages when running pygame code, it won't show me anything but a blank screen. I'm using the following code to test it:
import pygame
pygame.init()
screen = pygame.display.set_mode((800,600))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
screen.fill((255,0,0))
pygame.display.update()
pygame.quit()
On my old macbook the test code gives me a red screen as expected. Both macbooks are running python 2.7.10.
Does anyone have any idea what I'm doing wrong? I think I installed pygame exactly like I did on my old macbook and the only difference seems to be the operating system.
edit 1:
I write the script in Sublime Text and run the program in Terminal.
Screenshot
edit 2:
I got pygame working again by downgrading my operating system to macOS High Sierra.
Tested and works on macOS 10.15 Catalina, Python 3.7.5, PyGame 2.0.0 (pre-release as of this writing) and PyGame 1.9.6 (stable as of this writing).
Initially you need to decide if you want a stable release or a pre-release (unstable). If you decide to use the latest (and possibly pre-release/unstable) then just ignore the first step ("1. Find the latest stable release version") and use master branch at step 4 of the second step ("2. Install PyGame from source").
1. Find the latest stable release version
Go to PyGame's GitHub page here:
As you can see as of this writing the latest stable release is 1.9.6 so we hold this tag name for later.
2. Install PyGame on macOS from source
Install some dependencies brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf. This requires homebrew.
Go to site-packages:
For virtual environment go to cd ~/.virtualenvs/myvirtualenv/lib/python3.X/site-packages where ~/.virtualenvs/myvirtualenv is the path to your virtual environment and python3.X is the version of your Python.
For system-wide installation go to /usr/local/lib/python3.X/site-packages where python3.X is the version of your Python.
Delete any previous pygame, pip uninstall pygame (if a pygame directory exists in site-packages then remove it: rm -rf pygame*)
Clone PyGame from GitHub:
git clone https://github.com/pygame/pygame.git for the latest (possibly not stable version).
git clone -b 1.9.6 https://github.com/pygame/pygame.git --single-branch for the latest (1.9.6 is the tag name of the latest stable release, as of this writing, see "Find the latest stable release version above")
Go into the newly cloned pygame directory: cd pygame.
Run python setup.py --config --auto --sdl2.
If you get problems with this command, some users below mentioned that single hyphens worked for them, therefore try: python setup.py -config -auto -sdl2.
If you get any problems regarding Python2/3 and you are targeting Python3 try to change python setup.py --config --auto --sdl2 to python3 setup.py --config --auto --sdl2.
Run python setup.py install (it will take a while).
If you get any problems regarding Python2/3 and you are targeting Python3 try to change python setup.py --config --auto --sdl2 to python3 setup.py --config --auto --sdl2.
Now PyGame should work as expected on macOS.
I also face this problem on the macOS Catalina. Actually it is a version problem of pygame. Firstly I have installed with the following command:
pip3 install pygame
An only blank screen was showing. But later on, I have changed the version with the following command:
pip3 install pygame==2.0.0.dev4
With this version my problem was solved. It was working perfectly.
LATEST UPDATE for MacOS 10.14.1
If you download the official macOS x64 installer package of Python 3.7.2 from the official python.org page and type pip3 install pygame, it works.
There's an issue with MacOS. It should be possible to fix in SDL.
https://discourse.libsdl.org/t/macos-10-14-mojave-issues/25060/8
https://bugzilla.libsdl.org/show_bug.cgi?id=4274
The pygame issue is here: https://github.com/pygame/pygame/issues/555
The homebrew issue is here: https://github.com/Homebrew/homebrew-core/issues/33016
I ran into this issue using macOS Catalina version 10.15.2, Python 3.7.2 and pygame 1.9.6. I upgraded to Python 3.8.1, Pygame 2.0.0.dev6 and it is now working as expected.
I tried upgrading my old macbook to OS Mojave to see if pygame would stop working, and it did!
I guess Mojave isn't compatible with pygame (yet).
Thanks for the help!
Edit with working workaround:
see bottom of post
I get the same problem on a MacBook Pro (Retina display) with python3.7 and MacOs Mojave.
For the sake of simplicity, I did all my tests with your exact same code and pygame 1.9.4.
On (two) Windows computers, the program works and shows a red window on :
python2.7
python3.6
python3.7
Hence it doesn't seem to be a Python version problem, I lean toward a MacOS Mojave problem.
Mojave introduced 'Dark mode' which automatically tint windows. When dark mode is disabled, I get a blank screen. When it is enabled, I get a dark screen. Might it be that MacOS takes control of the screen display and fiddles with the way pygame controls the screen? It is just a theory but I don't know how to test it.
Edit:
I tried a pygame program that records and prints the position of the screen on which you clicked. It does output the position in the console, alas it doesn't display anything.
Apart from the faulty display, pygame seems to work properly.
Edit:
For now, using the Python version from miniconda and using CogSci's pygame seems to work.
I've tried everything but nothing worked except this:
pip install git+https://github.com/pygame/pygame.git
This installs the tips of the pygame. It worked for me. Give it a try.
I ran into this problem with the following environment: Python 3.7, Mojave 10.14.2, Pygame 1.9.4
I found that downgrading to Python 3.6 fixes the issue
$ brew unlink python
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
That should fix it, if you get a circular dependency problem you should then run:
$ brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
Details at https://apple.stackexchange.com/questions/329187/homebrew-rollback-from-python-3-7-to-python-3-6-5-x
I had the same issue, got it to work by downgrading python to 3.6.5.
> brew unlink python brew install --ignore-dependencies
> https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
> brew switch python 3.6.5_1 pip3 install pygame
If you already have python 3.6.5 install I guess you can just use switch.
Some macs need updates. If you go to system preferences and you go to software updates, you could try updating to see if it needs any updates. When you update, you can check to see if your code works now because it looks like your code is correct.
I need to install qscintilla. I use pip for that:
> pip install qscintilla
PyQt5 automatically upgrades to the latest version '5.8.2', and sip upgrades to '4.19.2'. I suppose this has to do with the needs of qscintilla. Perhaps the latest version of qscintilla needs the latest PyQt version to operate properly.
Unfortunately, PyQt5-5.8.2 combined with sip-4.19.2 don't work on Windows 10. I get the following error:
> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.
I have checked my PATH variable in Windows 10, and I found the following directory: C:\Anaconda3\Library\bin. I've checked that folder, and the dll's are all present: Qt5Widgets.dll, 'Qt5Gui.dll`, ... So I can hardly believe that Python cannot find them.
I will now go through the things I've tried so far.
1. Clean install of Anaconda => upgrade PyQt5.
I've removed Python completely from my PC, and installed Anaconda from scratch: Python 3.6 for Windows 64-bit.
Anaconda is shipped with an older version of PyQt5. I check the version like this:
> python
>>> from PyQt5.QtCore import QT_VERSION_STR
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> from sip import SIP_VERSION_STR
>>>
>>> QT_VERSION_STR
>>> '5.6.2'
>>> PYQT_VERSION_STR
>>> '5.6'
>>> SIP_VERSION_STR
>>> '4.18'
I simply upgrade my PyQt version, because I know that the qscintilla installation would do that anyway. If the problem is present after upgrading PyQt (and before installing qscintilla), I can rule out possible problems caused by the qscintilla installation. So here we go:
> pip install pyqt5 --upgrade
Collecting pyqt5
...
Successfully installed pyqt5-5.8.2 sip-4.19.2
As I expected, the upgraded version of pyqt results in the error:
> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.
2. Install PyQt5-5.7.1 instead of PyQt5-5.8.2.
I've found a wheel file from PyQt5-5.7.1 on this page: https://pypi.python.org/pypi/PyQt5/5.7.1
I hope that qscintilla will work on this one too. After all, it is a quite recent version. But first, I want to find out if I get it installed properly, and if the error above has gone.
> pip uninstall PyQt5
> pip uninstall sip
>
> pip install C:\..\Downloads\PyQt5-5.7.1-5.7.1-cp34.cp35.cp36-none-win_amd64.whl --no-cache-dir
...
Successfully installed pyqt5-5.7.1 sip-4.19.2
Unfortunately, the error persists.
3. Answers from StackOverflow.
I've checked several posts on StackOverflow, but none of them helped me out.
This post is too old: PyQt5 : The DLL load failed : the specified module could not be found
This post gives a possible reason: "Probably it's because pyqt .pyd files are linked against python3.dll, and not python3.6 dll." DLL load failed when importing PyQt5 . The answer suggests that I should use an older version of PyQt5. I've tried that (see above), but it still fails. The answer also suggests to build PyQt5 from the source code. I've tried that as well, but the build process gets stuck..
Can anyone help me? Perhaps you have successfully built the latest PyQt5-5.8.2 version from source code into a wheel file? I would be so happy if you share that file.
The root issue for me was different versions of PyQt wheel (5.9) and pyqt windows distro (5.6 - the last precompiled version available).
I found matching 5.6 wheel, but it only supported Python 3.5.
So, I downgraded Python to 3.5 and installed PyQt5-5.6-cp35-none-win_amd64.whl
pip install pyqt5==5.6
works equally well.
I found a workaround: don't use Anaconda. I deleted Anaconda from my PC and did a fresh install like this:
1. Install Python 64-bit
Download the 64-bit installer for Windows from this URL: https://www.python.org/downloads/release/python-361/
Make sure to include pip when asked for the installation options!
2. Install PyQt5
Install PyQt5 by typing the following in your Windows command terminal:
> pip install PyQt5 --no-cache-dir
...
Successfully installed PyQt5-5.8.2 sip-4.19.2
The --no-cache-dir option makes sure that pip will not use an old version stored somewhere on your computer, but download the latest one instead.
3. Install QScintilla
Install QScintilla like this:
> pip install qscintilla --no-cache-dir
Successfully installed qscintilla-2.10
It does work on windows 10. Your application failed to access specified DLL. A restart is required to get it working. I went through all the answers in the SO forums and it turns out a computer restart can set everything straight. so restart your pc.