Retaining question for posterity; see workaround in edit
The Pyglet package comes installed at base and isn't removable. Using the current fully updated version 1.1.4 of Pyglet, I get repeatable errors related to importing the item pyglet.gl.gl_info; for instance, upon attempting to create a pyglet.window.Window(), upon trying to import pyglet.gl, or upon attempting to import pygarrayimage via from pygarrayimage.arrayimage import ArrayInterfaceImage.
In all such cases the relevant traceback ends with the uninformative message:
/Users/[username]/Library/Enthought/Canopy_64bit/System/lib/python2.7/site-packages/pyglet/image/__init__.py in <module>()
142
143 from pyglet import gl
--> 144 from pyglet.gl import *
145 from pyglet.gl import gl_info
146 from pyglet import graphics
/Users/[username]/Library/Enthought/Canopy_64bit/System/lib/python2.7/site-packages/pyglet/gl/__init__.py in <module>()
102 from pyglet.gl.glext_arb import *
103 from pyglet.gl.glext_missing import *
--> 104 from pyglet.gl import gl_info
105
106 import sys as _sys
ImportError: cannot import name gl_info
I am using OSX 10.6.8 on an Intel processor, with Canopy 64-bit, and these are 100% repeatable.
Given the traceback one might assume gl_info mistakenly isn't included, but this isn't the case. dir(pyglet.gl.gl_info) can successfully be run.
Edit: Solved this problem.
Pyglet 1.1.4 does not support 64-bit on OSX, so until Enthought packages a newer release of Pyglet in Canopy, here is a workaround for 64-bit OSX users.
Acquire source for any release of Pyglet 1.2alpha1 or beyond.
Extract source to your directory of choice.
Append this directory to the beginning of your PYTHONPATH environment variable, in both ~/.bash_profile (for terminal shells) and /etc/launchd.conf (for GUI processes) with a line similar to: export PYTHONPATH=/Users/[username]/src/pyglet-1.2alpha1:$PYTHONPATH
Run this bash command in an unrelated directory and confirm the path printed leads to your 1.2alpha1 source directory: $ python -c "import pyglet; print pyglet.__path__[0]"
If you don't wish to modify your bash_profile, you can simply do the following:
Extract latest Pyglet source to your directory of choice and cd to that directory (it should contain a setup.py file).
Use Canopy's Python to install Pyglet by doing the following (on Mac 64 bit):
~/Library/Enthought/Canopy_64bit/User/bin/python setup.py install
The location of Canopy's Python for different platforms is listed here:
https://support.enthought.com/entries/23646538-Make-Canopy-s-Python-be-your-default-Python-i-e-on-the-PATH-
Related
My application uses the virtual module Qt to access properties like "Qt.Checked" or "Qt.WindowModal", but in trying to get my application working on my new Windows 11 test machine, I get
Traceback (most recent call last):
File "C:\Users\<redacted-path>", line 6, in <module>
from PyQt5.Qt import Qt, QApplication, QIcon
ImportError: cannot import name 'Qt' from 'PyQt5.Qt' (C:\Users\<redacted-user>\AppData\Local\miniconda3\lib\site-packages\PyQt5\Qt.pyd)
This doesn't happen on Windows 10, Mac, Linux, or even some other Windows 11 machines. Imports work fine when addressing specific modules like from PyQt5.QtWidgets import QApplication. It's just when importing the Qt namespace module that I get an import error. I get the same error with python 3.7, 3.8, and 3.9, and when using a system install of python or a conda install. This is a fresh environment that I stood up just to test this. It wasn't resolved by using different PyQt5 version or force reinstalling it. The file in question is in the site packages directory when I inspect the PyQt5 install, so it's not a matter of a corrupted installation.
I suspect this is also contributing to the dll import errors that my users sometimes see when using the cx_freeze generated installer.
Has anyone seen this before, have resolution steps, or guidance to put me down the right path? I could just rip out the Qt import, but it is marginally quicker to import this way than to import every module on its own line.
Machine Details:
Device: Dell Latitude 3420
Processor: 11th Gen Intel(R) Core(TM) i5-1135G7 # 2.40GHz 1.38 GHz
System Type: 64-bit operating system, x64-based processor
OS Edition: Windows 11 Pro
OS Version: 22H2
OS Build:22621.1105
I am using VQGAN+CLIP_(Zooming)_(z+quantize_method_with_addons).ipynb Google Repository and when I click the cell "Loading of libraries and definitions"
It sent an error :
ImportError Traceback (most recent call last)
<ipython-input-6-fe8fafeed45d> in <module>
24 from omegaconf import OmegaConf
25 from PIL import Image
---> 26 from taming.models import cond_transformer, vqgan
27 import torch
28 from torch import nn, optim
1 frames
/content/taming-transformers/main.py in <module>
10 from pytorch_lightning.trainer import Trainer
11 from pytorch_lightning.callbacks import ModelCheckpoint, Callback, LearningRateMonitor
---> 12 from pytorch_lightning.utilities.distributed import rank_zero_only
13
14 from taming.data.utils import custom_collate
ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' (/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/distributed.py)
I don't know how to solde this problem. I don't know how to manually install Pytorch as it said "NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below."
Thank you in advance if you have the solution.
Inès
I triad !pip install but I may not really know where to put this cell/line of code
pytorch_lightning has recently released a new version which will throw this error (version 1.8.0.post1 released on November 2nd 2022).
https://pypi.org/project/pytorch-lightning/#history
Just install an older version of pytorch_lightning and it will work.
In my system, I ran "pip install pytorch-lightning==1.6.5", higher versions may work as well, you can check them out by clicking on the link provided above and then clicking on release history.
Finally, after long research, I found the solution for it, try to run it, you will face an issue with CLIP module, once you resolve python issue as well, so for that follow the second code.
conda install pytorch-lightning -c conda-forge
Once you clone it, try to follow below command
Step:1 cd CLIP
Step2: python setup.py
after that,
type: cd..
Once you do that, you will be redirected to previous directory named "VQGAN-CLIP"
and finally, run the following command:
python generate.py -p "A painting of an apple in a fruit bowl"
Once it is done, then run your generate python file, It will work fine.
use #vishisht-rao solution to downgrade the package version of pytorch-lightning to 1.7.7; this step by itself did not solve the problem for me.
pip install pytorch-lightning==1.6.5
run pip list|grep lightning to find the installed version of lightning-utilities. Mine was lightning-utilities==0.4.2
Downgrade the package version of lightning-utilities to 0.4.0
pip install lightning-utilities==0.4.0
Downgrading the package versions of both pytorch-lightning and lightning-utilities solved the problem for me.
I encountered an import problem by PyAudio.
I have a winodws 10, 64 bit, and use Anaconda and Spyder IDE with python 3.7.
I installed PyAudio in Ananconda, ran as administrator, with these commands :
cd
conda install -c conda-forge PyAudio
The installation ran without any problems.
I then restarted both Anaconda and SPYDER. PyAudio now shows up in Anaconda's list of installed packages.
When I try to import Pyaudio in Spyder (IPython console), I encounter this error message :
[1]: import pyaudio
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
File "", line 1, in
import pyaudio
File "C:\ProgramData\Anaconda3\lib\site-packages\pyaudio.py", line 116, in
import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.
I tried to fix it by answers to similar ImportError message issued, while other users tried to import other packages like SKlearn ... , but with no success.
Your problem (and mine) are the same. The issue is, unfortunately, the version of python you're running (in tandem with your OS).
Check out this link:
https://people.csail.mit.edu/hubert/pyaudio/#:~:text=Note%3A%20As%20of%20this%20update,4.
Under the INSTALLATION section in the link for WINDOWS, PyAudio's latest version (0.2.11) is compatible with Python versions: 2.7, 3.4, 3.5, 3.6.
My current python is 3.8.5, so you (and I) could never use PyAudio unless they added compatibilities or we revert to an above python version.
I tried to install portaudio using
conda install portaudio
but it seems like it didn't work as it should be. However,
conda install -c anaconda portaudio
solved the problem.
see the official anaconda page
I have seen many more or less related questions on this topic, but none helped me finding a way to solve my problem.
I'm not very familiar with Windows environment, deep apologies if my question sounds obvious to some extent.
Setup:
Windows 10
Python 3.7.0 (installed through latest Anaconda release)
Spyder 3.3.1
Im running a Python, that involves several modules import. I came across some module issues. For example:
from PIL import Image as PIL_Image
Works smooth in Spyder, but gives (error message in french but I guess you got the point):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\my_user_name\Anaconda3\lib\site-packages\PIL\Image.py", line 64, in <module>
from . import _imaging as core
ImportError: DLL load failed: Le module spécifié est introuvable.
If executed in Powershell or cmd.
What I tried:
Appending Anaconda's install path to my path variable before I open Powershell:
$Env:path += ";C:\Users\my_user_name\Anaconda3;C:\Users\my_user_name\Anaconda3\Scripts"
Checking that sys.path is the same in Powershell and Spyder. For both, it looks like:
['',
'C:\\Users\\my_user_name',
'C:\\Users\\my_user_name\\Anaconda3\\python37.zip',
'C:\\Users\\my_user_name\\Anaconda3\\DLLs',
'C:\\Users\\my_user_name\\Anaconda3\\lib',
'C:\\Users\\my_user_name\\Anaconda3',
'C:\\Users\\my_user_name\\AppData\\Roaming\\Python\\Python37\\site-packages',
'C:\\Users\\my_user_name\\Anaconda3\\lib\\site-packages',
'C:\\Users\\my_user_name\\Anaconda3\\lib\\site-packages\\win32',
'C:\\Users\\my_user_name\\Anaconda3\\lib\\site-packages\\win32\\lib',
'C:\\Users\\my_user_name\\Anaconda3\\lib\\site-packages\\Pythonwin',
'C:\\Users\\my_user_name\\Anaconda3\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\my_user_name\\.ipython']
What else could explain that my import fails outside of Spyder ?
Ok I could not find a clean way out, so let me just share my experience in case someone finds it helpful ...
The DLL failure with PIL related libs seems to be a known issue. See further explanations:
https://github.com/python-pillow/Pillow/issues/2945
PIL: DLL load failed: specified procedure could not be found
How I solved my issue:
Cleanly uninstalled anything related to Python on my laptop. Both Anaconda, isolated Python installs, Spyder ...
Re-installed the latest Anaconda. It happens to come with Python 3.7.1 instead of 3.7.0
Re-did my PIP installs of everything. Note I had to append Anaconda\Library\bin to my Windows path for PIP to work completely, which I don't recall having done with my previous installation.
In cryptography which was included using pip install PyCrpto giving an error after including it in a flask application where we are running it using virtual environment have named it venv and have this dependency correctly installed in venv > lib > python2.7 > site-packages.
Below is the exact error which I am getting here.
from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency
But as can be seen in screenshot file cryptography.x509.certificate_transparency.py is there in file structure and even on trying python -c "from cryptography.x509 import certificate_transparency" doesn't show any warnings but here it shows error which is also marked in red.
What can be possibly wrong here ?
I came across this problem when I was building an updated Python Crypto module for shipping with Solaris (see https://www.jmcpdotcom.com/blog/2018-02-21-im-embarrassed-to-admit-it/).
The root cause in your case appears to be that you haven't installed it in the right place. While you claim above that it's "correctly installed" in venv > lib > python2.7 > site-packages the screenshot shows that it is in fact in venv/lib/cryptography. If you move the cryptography dir down a level I would expect that your import would work.