I have installed all libraries we need on this project except ‘’ Cartopy library ‘’ in Pycharm. After some research I thought it might be due to the python version so I tried dowloading the Cartopy Library in about 5 different Python versions and again the Cartopy Library is not installed.
After some more research, I thought of changing the version of Pycharm. I dowload version of 2020 and 2021 of Pycharm. Unfortunately i still got the same error :
“Error occurred when installing package ‘Cartopy”.
enter image description here
I have encountered a similar issue with another package and the problem wasn't in the IDE but the OS which in my case was mac. I had to install an ubuntu in parallel and migrate the whole project there and it ran perfectly.
I suggest you use conda instead of pip and if the issue didn't go away check the compatibility with your OS and if this is the issue you can simply install a virtual machine.
I'm having trouble installing packages and using them in Pycharm. I've followed various threads (I'm new to Macs and seem to have tried everything) now I'm stuck.
In this case, I want to use the package xgboost.
I have brew installed, after launching a terminal using Rosetta:
%brew install xgboost
Warning: xgboost 1.3.3 is already installed and up-to-date.
It appears installed OK here:
/opt/homebrew/Cellar/xgboost
I also have Python installed here:
/opt/homebrew/Cellar/python#3.9
But no matter how I configure an Interpreter in Pycharm, I can't seem to get the package recognised.
Where have I gone wrong?
I am very unsure exactly how, but I've got this working.
Following: https://abbasegbeyemi.me/blog/homebrew-python-apple-m1
I changed the order of elements in my path:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin
then a new interpreter in Pycharm using:
usr/local/Cellar/Python#3.9/3.9.2_2/bin/python3.9
Now I can install packages just using pip in pycharm and it works.
This has been 6 hours of pain - warning to anyone who isn't well versed in macs, setting up an M1 for python dev was a complete nightmare for me.
Docs: https://xgboost.readthedocs.io/en/latest/build.html
Pre-built binary wheel for Python
If you are planning to use Python, consider installing XGBoost from a pre-built binary wheel, available from Python Package Index (PyPI). You may download and install it by running
# Ensure that you are downloading one of the following:
# * xgboost-{version}-py2.py3-none-manylinux1_x86_64.whl
# * xgboost-{version}-py2.py3-none-win_amd64.whl
pip3 install xgboost
During the installation phase, I get this, "Unable to find vcvarsall.bat" error. The installation process did complete, though. However, I was unable to see the shell on my desktop (I am using windows) and neither was I able to open it manually. I scoured the internet for the error but was unable to find any solution for this case.
The installation process is through a superpack that downloads Python 2.7
SimpleCV is not receiving much love in the past few years, and most of it's code don't got upgrade like the libraries it depends on.
The problem you got is the Superpack trying to compile an older version of OpenCV.
When running the Superpack, you should have seen and redtext error, and if you try to run a code it should show you something like this:
File "C:\Python27\lib\site-packages\SimpleCV\base.py", line 59, in <module>
raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
ImportError: Cannot load OpenCV library which is required by SimpleCV
There are a few paths you can try from there:
1. You can try to install Microsoft Visual C++ Compiler for Python 2.7
Uninstall everything SuperPack installed in your PC or it may not work
It may fixes some other uses when using pip.
Now you have to install SimpleCV again.
2. Try to install OpenCV(2.3) on your own:
You can use pip for it, just remember to chose 32bits to keep compatibility with (Super Pack)
Just run on CMD
pip install OpenCV or python -m pip install OpenCV
3. Give up on SuperPack and install everything on your own.
You can try this guide
https://github.com/sightmachine/SimpleCV#windows-7vista
Or use pip for all dependencies
numpy (Numpy+MKL make sure to install this one first)
scipy
PIL
ipython
svgwrite
pygame==1.9.1release
OpenCV
You can find a useful list of wheels here
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
Sources:
https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
https://github.com/sightmachine/SimpleCV#windows-7vista
I am running Anaconda Python 2.7 on a Win7 x64 machine and used
pip install PyOpenGL PyOpenGL_accelerate
at the Anaconda command line to install PyOpenGL.
I have some code (not my own I must confess) that makes use of glutInit
import sys
import math
import numpy
import OpenGL
from OpenGL.GL import *
from OpenGL.GLUT import *
import Image
import linkage
# ... a whole load of definitions etc ...
glutInit(sys.argv)
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
glutInitWindowSize(600, 600)
glutCreateWindow('linkage')
init()
initWindow()
glutIdleFunc(idle)
glutMainLoop()
I run by entering the following at the command line:
python main.py peaucellier.txt
But then get the following error (line 371 is the glutInt(sys.argv) line above)
File "C:/Users/Owner/Documents/Python Scripts/linkage/main.py", line 371, in <module>
glutInit(sys.argv)
File "C:\Anaconda\lib\site-packages\OpenGL\GLUT\special.py", line 333, in glutInit
_base_glutInit( ctypes.byref(count), holder )
File "C:\Anaconda\lib\site-packages\OpenGL\platform\baseplatform.py", line 407, in __call__
self.__name__, self.__name__,
NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling
I have looked at similar errors posted in this forum but none of the proposed fixes are working which is why I'm asking, what's wrong here?
Is the installation at fault? Are the imports correct?
EDIT: After trying many many fixes for the official release I am now using an unofficial release that works perfectly from Unofficial Windows Binaries for Python Extension Packages
According to the link below the problem was with the glut installation rather than pip install. It seems glut files are not part of PyOpenGL or PyOpenGL_accelerate package. You have to download them seperately.
https://stackoverflow.com/a/39181193/7030177
Windows user can use the link below to download glut as mentioned in the given link.
ftp://ftp.sgi.com/opengl/glut/glut3.html.old#windows
Linux Users can just install glut using the following command:
sudo apt-get install freeglut3-dev
Hope this helps :)
After looking around for a solution to a similar problem I ran across this google group that answers the question: https://groups.google.com/forum/#!topic/glumpy-users/aC1NjEHXtEE
There is a problem with OpenGL.GLUT when downloaded as pip from the official source. Uninstall OpenGL using pip, then download OpenGL from http://www.lfd.uci.edu/~gohlke/pythonlibs/
For people on Linux with this error after installing via easy_install PyOpenGL or pip install PyOpenGL.
-> Install the distribution package as: sudo apt-get install python-opengl - this works for me.
If installing PyOpenGL from easy_install, pip or conda, make sure that you have already installed a GLUT implementation, such as FreeGLUT (prebuilt Windows binaries).
For FreeGLUT, copy the distributed files to a location on your hard drive and then add the path to the bin directory (which contains the GLUT DLLs) to your PATH environment variable. Then PyOpenGL should work as expected.
It is mainly because you're running 64-bit windows put pip is installing 32-bit version of PyOpenGL.
To fix this, follow these steps:
Uninstall existing PyOpenGL, Run pip uninstall PyOpenGL PyOpenGL_accelerate
Download the 64-bit builds of PyOpenGL and PyOpenGL accelerate from here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl
How to choose which one to download? Well, first you need to check your python version. Run python --version to determine.
Then according to your version download the whl files for PyOpenGL and PyOpenGL accelerate. For example, if you have Python 3.8, download these 2 files:
PyOpenGL‑3.1.5‑cp38‑cp38‑win_amd64.whl
PyOpenGL_accelerate‑3.1.5‑cp38‑cp38‑win_amd64.whl
Similarly, if you run Python 3.9, download these instead:
PyOpenGL‑3.1.5‑cp39‑cp39‑win_amd64.whl
PyOpenGL_accelerate‑3.1.5‑cp39‑cp39‑win_amd64.whl
Note: Must download amd64 ones, after all, you're running 64-bit windows.
Now go to the folder where you downloaded the files and run powershell/cmd with administrator there.
Use pip to force install those files. For example:
pip install PyOpenGL-3.1.5-cp38-cp38-win_amd64.whl --force-reinstall
pip install PyOpenGL_accelerate-3.1.5-cp38-cp38-win_amd64.whl --force-reinstall
Note: Install PyOpenGL first and then PyOpenGL_accelerate
If the installation succeeds, you may be able now to run.
Some facts to make sure:
*All platforms must be of the same bit version.
*System type, python, OpenGL needs to be of the same bit version. In my case it was x64 bit
*It is necessary to restart your desktop if you reinstall any one of them (Python, OpenGL)
*It is recommended to keep your pip version at 20.3, I downgraded it from 21.1.3
I got the same error and a solved installing required files from here.
Download these files:
PyOpenGL-3.1.1-cp27-cp27m-win32.whl (download if your computer 32 bits )
PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl (download if your computer 64 bits )
PyOpenGL_accelerate-3.1.1-cp27-cp27m-win32.whl (download if your computer 32 bits )
PyOpenGL_accelerate-3.1.1-cp27-cp27m-win_amd64.whl (download if your computer 64 bits )
install these .whl files for 64 bits:
pip install PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl
pip install PyOpenGL_accelerate-3.1.1-cp27-cp27m-win_amd64.whl
install these .whl files for 32 bits:
pip install PyOpenGL-3.1.1-cp27-cp27m-win32.whl
pip install PyOpenGL_accelerate-3.1.1-cp27-cp27m-win32.whl
for python 2.7, PyopenGL needs vc++ 9 compiler, download and install it.
then:
python -m pip install --upgrade pip
pip install image
pip install numpy
pip install PyOpenGL PyOpenGL_accelerate
I downloaded freeglut
unzipped it and added bin directory to the path
when calling: glutCreateWindow("sometitle")
changed to glutCreateWindow(b'sometitle')
and got it run on windows 7
My case is different, Python 3.6 and windows 10. However exactly same error message. Tried all above solutions, no success.
Downloaded WHL file right to my computer and version of python from HERE
Then pip installs filename.Whl, no more issue!
The answer was from a Chinese website: Answer Link
Yes, this happened to me on Windows 10 running python 2.713 anaconda 4 64 bit. I had used conda to install pyopengl but received the same error as above. So I downloaded freeglut from transmissionzero and just copied the freeglut.dll (64 bit for me) to the same directory as my source file (it just needs to be in the dll searchpath) and all was good.
I know it is a little late. I also encountered this problem with python 2.7 (32 bits) in windows. I tried the method mentioned by user2723240 but still failed. Finally, I solved this problem by copying glue32.dll to System32 in C drive and copy glue32.dll into my source file directory. It works well now.
On linux, the pyopengl module attempts to use ctypes module to load the glut library as simply 'glut'. According to ctypes documentation the loadLibrary routine must be given the complete filename. Therefore, I made a symbolic link to libglut.so and named it 'glut' and everything just worked.
The following command should work for Anaconda users:
conda install -c conda-forge freeglut
https://anaconda.org/conda-forge/freeglut
On windows, although PyOpenGL says it installs freeglut by default, it does not.
To patch it, you must download or compile freeglut (other answers here contain the appropriate links) and place it in a new site-packages/OpenGL/DLLS folder inside to your existing OpenGL site-packages installation.
Once there, the freeglut.dll needs to have the bits and the MSVC version appended to the filename. OpenGL/platform/win32.py has the details on exactly how it's detected.
To make it clearer the filename needs to be the one printed from the following script:
import sys
import platform
if sys.hexversion < 0x2070000:
vc = 'vc7'
elif sys.hexversion >= 0x3050000:
vc = 'vc14'
elif sys.hexversion >= 0x3030000:
vc = 'vc10'
else:
vc = 'vc9'
size = platform.architecture()[0].strip('bits')
print(f'freeglut{size}.{vc}.dll')
Step 1
Install python in your system windows 10/11 preferred. for python 3.8.0 : https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe
If you have already installed then check for your python version
Open terminal and type "python --version"
it will display your python version. for example I have installed python 3.8.0.
Step 2
Next open terminal and run the below command
python -m pip install --upgrade pip==20.3
sometimes you have higher version of pip installed but its okay to downgrade back to version 20.3
Step 3
now for installing OpenGL go to this site : https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl
and download
PyOpenGL‑3.1.6‑cp38‑cp38‑win_amd64.whl (for 64bit windows) or
PyOpenGL‑3.1.6‑cp38‑cp38‑win32.whl (for 32 bit)
and
PyOpenGL_accelerate‑3.1.6‑cp38‑cp38‑win_amd64.whl (for windows 64bit) or
PyOpenGL_accelerate‑3.1.6‑cp38‑cp38‑win32.whl (for windows 32bit)
Note : I have in installed python 3.8.0. so I downloaded PyOpenGL having cp38 word in it. If you have installed python 3.9 or other version download the above mentioned file having name cp39,cp10 etc.
after downloading both files according to your python version. put it a folder.
Step 4
then open terminal from that folder. Windows 10 lets you launch Command Prompt in a folder through the File Explorer's address bar. Type “cmd” in the address bar and then hit Enter
after opening terminal enter the below command
pip install PyOpenGL-3.1.6-cp38-cp38-win_amd64.whl --force-reinstall
then after installing it run the below command
pip install PyOpenGL_accelerate-3.1.6-cp38-cp38-win_amd64.whl --force-reinstall
Note : Don't forget to change the file name ( e.g. : PyOpenGL-3.1.6-cp38-cp38-win_amd64.whl) to the file name that you have downloaded.
I have Python 2.7 on Windows 7 x64. I have installed virtualenv and installed Pinax withing the project in virtualenv. When I try to syncdb I recieve an error stating PIL is needed. I tried installing PIL 1.1.7 for 2.7, but it did not install correctly. When I ran syncdb I get the following error.
Error: One or more models did not validate:
photologue.photo: "image": To use ImageFields, you need to install the Python Im
aging Library. Get it at http://www.pythonware.com/products/pil/ .
photologue.watermark: "image": To use ImageFields, you need to install the Pytho
n Imaging Library. Get it at http://www.pythonware.com/products/pil/ .
avatar.avatar: "avatar": To use ImageFields, you need to install the Python Imag
ing Library. Get it at http://www.pythonware.com/products/pil/ .
photos.image: "image": To use ImageFields, you need to install the Python Imagin
g Library. Get it at http://www.pythonware.com/products/pil/ .
As I understand it is because this is a x32. So I downloaded the unoffical x64 version from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil and tried to install. Windows installer states that it can not locate python so it can not install PIL. I checked the registry and python is there.
Any thoughts because I am lost?
It's been awhile since I worked on Windows, but I believe you might need to install a 64-bit version of Python. I could be wrong, but I wouldn't think that 32-bit Python would be able to run 64-bit libraries. I think the error message you are seeing is that the 64-bit PIL is looking for 64-bit Python and can't find it.
You can install 32 bit PIL on Win7x64 as long as you are running 32 bit Python.