initfsencoding: Unable to load the file system codec after download - python-3.7

I downloaded Python 3.7, but whenever I try to run Python it shows
Fatal Python error: initfsencoding: unable to load the file system codec ModuleNotFoundError: No module named 'encodings'
Current thread 0x0000069c (most recent call first):

Related

PyCUDA -- problems importing pycuda.driver

Windows 10
Python 3.8
CUDA 11.5
I've installed what I believe to be a matching pycuda from this file:
pycuda-2021.1+cuda115-cp38-cp38-win_amd64.whl
This simple example fails
import pycuda.driver as drv
drv.init()
print("Detected {} CUDA devices".format(drv.Device.count()))
With this error:
Traceback (most recent call last):
File "C:/University of Arizona/weeds/tests/cuda-summary.py", line 5, in <module>
import pycuda.driver as drv
File "C:\Users\evan\AppData\Local\Programs\Python\Python38\lib\site-packages\pycuda\driver.py", line 65, in <module>
from pycuda._driver import * # noqa
ImportError: DLL load failed while importing _driver: The specified procedure could not be found.
NVCC is in my path
Adding os.add_dll_directory(os.path.join(os.environ['CUDA_PATH'], 'bin')) has no effect
The script works just fine on my Jetson Nano
Any ideas on how to get past this? I've searched and tried several solutions.
It is quite strange, but updating the Nvidia display driver fixed the issue for me.
But in my case there was no issue on my PC with the same versions of Windows, Python, CUDA and PyCuda. The issue appeared on the different Windows 10 machine, when launching the exe, packaged by PyInstaller. So, updating the display driver was the fix for this machine.

pySerial installed, but still getting ImportError

I am new to Python, so I have likely done something obviously wrong, though despite my best efforts I cannot figure out what.
I am running windows 7 64bit.
I only have Python 3.5 (32 bit) installed.
I updated pip to the latest version succesfully and used it to install pySerial. I am working in eclipse oxygen with PyDev installed. My run configuration does show the appropriate path (as far as I can tell):
run configuration in eclipse/PyDev
I have confirmed pySerial is installed by doing the following in python interpreter:
>>>help()
>>>modules
serial shows up in the list of modules.
also:
>>> import serial; print(serial.__file__)
C:\Python35\lib\site-packages\serial\__init__.py
Additionally, trying to use serial in the terminal works fine, as below:
>>> import serial
>>> s=serial.Serial("COM4")
>>> s
Serial<id=0x383b750, open=True>(port='COM4', baudrate=9600, bytesize=8, parity='N', stop
bits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
However, when I try to run the following code as a file:
import serial
print ("Test Script")
I get the following error:
Traceback (most recent call last):
File "C:\Users\H260643\Desktop\Projects\EclipseWorkspace\CMP_Thous_Hr\Base.py", line 1, in <module>
import serial
ImportError: No module named 'serial'
For what it's worth, the eclispe editor window has also flagged that line saying it is an "unresolved import: serial"
Right after posting this I realized that the install path for python/pySerial did not match what was in my eclispe/PyDev run configuration. I corrected my run configuration and all is well.

Error when executing Canopy's Pythonwin.exe (wincon32 module not found)

I'm sorry if my title doesn't make sense but that's the problem I'm having.
When executing a script at the command line, (or by double-clicking on it) using C:\pythonwin.exe SomeApp.pyw, I get a popup error box saying
ImportError: No module named wincon32. (Full error message at the bottom)
Just executing pythonwin.exe by itself with or without a script also has the same effect.
Google is amazingly bereft of any knowledge of wincon32. Trying to install wincon32 module with pip install wincon32 just says "Could not find a version that satisfies the requirement wincon32 (from version: ) No matching distribution found for wincon32"
pythonwin.exe is in the system's PATH.
Thanks for any help. Below is the full contents of the popup error box.
Title - Python Traceback
Traceback (most recent call last):
File "string", Line 1 in module
File "C:\Users\Me\Canopy(Python)\User\Lib\site-packages\pythonwin\pywin
\framework\startup.py", line 49, in _import_(moduleName)
File "C:\Users\Me\Canopy(Python)\User\Lib\site-packages\pythonwin\pywin
\framework\intpyapp.py", line 3, in import wincon32
ImportError: No module named wincon32
(I'm using Windows 10 x64)
Where did c:\Pythonwin.exe come from? It's not part of any Canopy installation that I've ever heard of. If you're trying to run Canopy Python, see https://support.enthought.com/entries/23646538-Make-Canopy-User-Python-be-your-default-Python

Import error: libjpeg.so.7: cannot open shared object file: No such file or directory

I install the academic Enthought Cannopy on Redhat. When I type in
import _imaging
It print out the error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libjpeg.so.7: cannot open shared object file: No such file or directory
But on the Enthough website, it was said that the libjpeg has been included.
The Canopy's version is 1.1.0. The output of env in terminal is:
MANPATH=/opt/torque/man:/usr/NX/bin:/usr/kerberos/bin:/usr/java/latest/bin:/share/apps/anaconda/bin:/usr/local/bin:/bin:/usr/bin:/opt/bio/ncbi/bin:/opt/bio/mpiblast/bin/:/opt/bio/hmmer/bin:/opt/bio/EMBOSS/bin:/opt/bio/clustalw/bin:/opt/bio/tcoffee/bin:/opt/bio/phylip/exe:/opt/bio/mrbayes:/opt/bio/fasta:/opt/bio/glimmer/bin://opt/bio/glimmer/scripts:/opt/bio/gromacs/bin:/opt/bio/gmap/bin:/opt/bio/tigr/bin:/opt/bio/autodocksuite/bin:/opt/ganglia/bin:/opt/ganglia/sbin:/opt/openmpi/bin/:/opt/maui/bin:/opt/torque/bin:/opt/torque/sbin
BIOROLL=/opt/bio
TERM=xterm-256color
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=141.211.38.9 36340 22
PHENIX_INSTALLER_DATE=300920111225
ROCKSROOT=/opt/rocks/share/devel
PHENIX_MVERSION=redhat-e5.4
PHENIX=/share/apps/phenix-1.7.2-869
SSH_TTY=/dev/pts/8
ANT_HOME=/opt/rocks
USER=xqding
PHENIX_MTYPE=intel-linux-2.6-x86_64
LS_COLORS=
ROCKS_ROOT=/opt/rocks
VIRTUAL_ENV=/home/xq/Enthought/Canopy_64bit/User
MAIL=/var/spool/mail/xq
PATH=/home/xqding/Enthought/Canopy_64bit/User/bin:/home/xq/Enthought/Canopy_64bit/User/bin:/home/xq/apps/bin:/share/apps/phenix-1.7.2-869/build/intel-linux-2.6-x86_64/bin:/library/yzhang/bin/HMMER:/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/X11R6/bin:/tmp/updates/rocks/bin:/tmp/updates/usr/sbin:/tmp/updates/sbin:/tmp/updates/usr/bin:/opt/rocks/bin:/opt/rocks/sbin:/opt/sun-ct/bin:/home/xq/apps/cd-hit-v4.6.1-2012-08-27:/home/xq/apps/samtools-0.1.19:/library/blast/bin:/home/xq/apps/cd-hit-v4.6-2012-04-25:/home/xq/apps/dssp-2.2.1:/home/xqding/apps/dssp-ver2hor:/home/xq/bin:/home/xq/apps/python/2.7/bin
NXDIR=/usr/NX
INPUTRC=/etc/inputrc
PWD=/home/xqding/appsrc
JAVA_HOME=/usr/java/latest
EDITOR=emacsclient
LANG=en_US.iso885915
PHENIX_USE_MTYPE=intel-linux-2.6-x86_64
PHENIX_ENVIRONMENT=1
BLASTDB=/home/xqding/bio/ncbi/db
PHENIX_VERSION=1.7.2
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
PHENIX_RELEASE_TAG=869
SHLVL=1
HOME=/home/xq
ROLLSROOT=/opt/rocks/share/devel/src/roll
LOGNAME=xqding
CVS_RSH=ssh
LESSOPEN=|/usr/bin/lesspipe.sh %s
BLASTMAT=/opt/bio/ncbi/data
G_BROKEN_FILENAMES=1
_=/usr/bin/env
I download the source code of libjpeg version 7 and install it on the Redhat computer. Then add the library directory to the export LD_LIBRARY_PATH=directory of libjpeg. Then the problem is solved. I appreciate the help I got from here. So I just add the solution.
It's possible that the libjpeg version installed with your RedHat is outdated (are you on RedHat 5?). Try and open the RedHat package manager and look for "jpeg". Installing a later version of the library might fix this issue.

Python Hello World in PyObjC on iPhone?

I installed the iphone-python package from Cydia, but the HelloPython app closes immediately when I run it from Springboard.
This may be a red herring, but I found the .py file in Terminal and tried to run it with python and got a python error:
$ python /private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py
Traceback (most recent call last):
File "/private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py", line 9, in <module>
import objc
File "/usr/lib/python2.5/objc/__init__.py", line 17, in <module>
_update()
File "/usr/lib/python2.5/objc/__init__.py", line 14, in _update
import _objc
ImportError: dlopen(/usr/lib/python2.5/lib-dynload/_objc.dylib, 2): Symbol not found: _OBJC_CLASS_$_Object
Referenced from: /usr/lib/python2.5/lib-dynload/_objc.dylib
Expected in: /usr/lib/libobjc.A.dylib
I'm running 4.3.3.
How can I get this app working, so I'll have a working example of PyObjC?
Well due to the changes in the way executables on the new ios run, the dynamic library has become corrupt. The mach-o will no longer run due to the upgraded objective-c so a workaround would be to compile pyobjc from source and run normaly. The only ptoblem with that is that the iphone's version of pyobjc is built for uikit so you would need to find saurik's (Jay Freeman) source code and compile it. I might do that for myself so ill post back with a deb file if i do.