I've been trying to run a colleague's script and though I have pandas running now, tkinter fails to load for some reason:
D:\>python
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\tkinter\__init__.py", line 36, in <module>
from tkinter import _fix
File "C:\Python34\lib\tkinter\_fix.py", line 65, in <module>
import _tkinter
ImportError: DLL load failed: %1 is not a valid Win32 application.
I was under the impression tkinter shipped with Python 3.4?
My computer is a 64-bit machine running Windows 7 if that makes a difference?
Related
OSError: no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': dlopen(libcairo.so.2, 2): image not found
cannot load library 'libcairo.2.dylib': dlopen(libcairo.2.dylib, 2): image not found
cannot load library 'libcairo-2.dll': dlopen(libcairo-2.dll, 2): image not found
Error comes when i try to use weasyprint library, I have checked so many solutions but didn't find the clear solution for MacOs(BigSur version 11.6).
I'm using python version 3.7. I have tried to use weasyprint with python 3.9 for which it is working perfectly fine.
Python 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import weasyprint
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/shashank/Desktop/work/env/lib/python3.7/site-packages/weasyprint/__init__.py", line 440, in <module>
from .css import preprocess_stylesheet # noqa isort:skip
File "/Users/shashank/Desktop/work/env/lib/python3.7/site-packages/weasyprint/css/__init__.py", line 30, in <module>
from . import computed_values, media_queries
File "/Users/shashank/Desktop/work/env/lib/python3.7/site-packages/weasyprint/css/computed_values.py", line 18, in <module>
from .. import text
File "/Users/shashank/Desktop/work/env/lib/python3.7/site-packages/weasyprint/text.py", line 14, in <module>
import cairocffi as cairo
File "/Users/shashank/Desktop/work/env/lib/python3.7/site-packages/cairocffi/__init__.py", line 50, in <module>
('libcairo.so.2', 'libcairo.2.dylib', 'libcairo-2.dll'))
File "/Users/shashank/Desktop/work/env/lib/python3.7/site-packages/cairocffi/__init__.py", line 45, in dlopen
raise OSError(error_message) # pragma: no cover
OSError: no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': dlopen(libcairo.so.2, 2): image not found
cannot load library 'libcairo.2.dylib': dlopen(libcairo.2.dylib, 2): image not found
cannot load library 'libcairo-2.dll': dlopen(libcairo-2.dll, 2): image not found
for Python version 3.9
(penv) shashank#Shashanks-MacBook-Pro pdf % python3 manage.py shell
Python 3.9.9 (main, Nov 21 2021, 03:16:13)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import weasyprint
>>>
It would be great help if anyone guide me through this problem. Thanks in Advance
While trying to do simulation in the Scientific Linux, I met the following error.
$ python plot_distribt.py
Loaded libmkl_rt.so for dgesvd
Loaded libmkl_rt.so for zgesvd
Traceback (most recent call last):
File "plot_distribt.py", line 32, in <module>
from mps.mps import iMPS
File "/work/wangb/DMRG/mps/mps.py", line 13, in <module>
from algorithms.linalg import np_conserved as npc
File "/work/wangb/DMRG/algorithms/linalg/np_conserved.py", line 294, in <module>
from algorithms.linalg import npc_helper
File "__init__.pxd", line 164, in init npc_helper
ValueError: numpy.dtype has the wrong size, try recompiling. Expected 88, got 96
After creating a virtual environment, I was able to upgrade packages via pip2 install --upgrade numpy --user python, and now I have numpy-1.16.6, scipy-1.2.3 and pandas-0.24.2. However, the above ValueError still occurred.
I have also checked that after opening python within the newly-created environment, I get
Python 2.7.18 |Anaconda, Inc.| (default, Apr 23 2020, 22:42:48)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.version.version
'1.7.1'
>>> numpy.__file__
'/usr/lib64/python2.7/site-packages/numpy/__init__.pyc'
>>>
Thus, the key might be how to avoid using the numpy-1.7.1? Note that I cannot change anything in /usr/lib64/python2.7/site-packages as I am using the cluster systems from our university.
Thanks a lot in advance!
After following the Ubuntu/Debian installation instructions for the Nest simulator I can only import the nest module in python2.x, not python3.x
$ python3
Python 3.6.8 (default, Aug 20 2019, 17:12:48)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nest/lib/python2.7/site-packages/nest/__init__.py", line 26, in <module>
from . import ll_api # noqa
File "/nest/lib/python2.7/site-packages/nest/ll_api.py", line 72, in <module>
from . import pynestkernel as kernel # noqa
ImportError: dynamic module does not define module export function (PyInit_pynestkernel)
The default install compiles with the default Python version which is still 2 in Ubuntu.
To use Python 3, run:
cmake -Dwith-python=3 -DCMAKE_INSTALL_PREFIX:PATH=</install/path> </path/to/NEST/src>
Mentioned here in the doc.
NB: don't forget to clear the build folder to avoid issues
So the issue is that apparently Django uses the sqlite3 that is included with python, I have sqlite3 on my computer and it works fine on its own. I have tried many things to fix this and have not found a solution yet.
Please let me know how I can fix this issue so that I can use Django on my computer.
:~$ python
Python 3.5.2 (default, Nov 6 2016, 14:10:16)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'
>>> exit()
I figured out that this error was caused by me changing my python path to 3.5 from the default of 2.7.
I am having a problem with "import "serial".
I am running Python 3.3.2 on Windows (XP) and have installed pyserial 2.5 from the Windows installer pyserial-2.5.win32.exe. The traceback below shows what happens.
C:\hal\Python>python
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python33\lib\site-packages\serial\__init__.py", line 19, in <module>
from serialwin32 import *
ImportError: No module named 'serialwin32'
>>>
The python interpreter finds and runs c:\python33\lib\site-packages\serial\ __init__.py, which checks the os name, finds that it is "nt" and executes "from serialwin32 import *". That fails.
The file serialwin32.py is in the \serial directory with __init__.py.
I tried this with Python 3.1.1 and 3.2.3 and got the same results.
I read that pyserial 2.5 is not dependent on pywin32 but I have it installed anyway; win32, build 18, for Python 3.3.
Has anyone seen this problem or know what I may be doing wrong?
Thanks