I'm trying to install CairoSVG for Python 3. I ran pip3 install cairosvg without any errors, but when I try to import the module via import cairosvg, I get this error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
import cairosvg
File "D:\Programs\Python3\lib\site-packages\cairosvg\__init__.py", line 41, in <module>
from . import surface # noqa
File "D:\Programs\Python3\lib\site-packages\cairosvg\surface.py", line 24, in <module>
import cairocffi as cairo
File "D:\Programs\Python3\lib\site-packages\cairocffi\__init__.py", line 41, in <module>
cairo = dlopen(ffi, 'cairo', 'cairo-2', 'cairo-gobject-2')
File "D:\Programs\Python3\lib\site-packages\cairocffi\__init__.py", line 38, in dlopen
raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2
cairosvg python package doesn't install cairo library on your computer. You need to download an installer and make sure it's accessable by python. Also you need to be aware if python is built for the same instruction set as cairo library (e.g. x32 — x32 and x86_64 — x86_64). Python can't use libraries built for other architecture.
Related
I am attempting to use cuPy to speed up some background numpy operations in my python code but when attempting to import cupy I am told that the DLL load failed and the module could not be found, cupy_backends.cuda.libs import nvrtc. (Specific errors at end of post)
I've attempted almost everything the error message suggests. I check my version of cupy and cuda which are cupy-cuda111==8.4.0, I have Cuda 11.2 installed as well. I am running Windows 10 and Python 3.7.6 on Spyder 3. I have tried uninstalling cupy via pip uninstall in hopes of reinstalling correctly but it just hangs and never uninstalls the package.
It appears I have the file its looking for when I go search manually via my file explorer. (Imaged Below)
I am fairly inexperienced when it comes to handling things like this so any help would be greatly appreciated. The entire error message and trace is copied below:
import cupy as cp
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\cupy\__init__.py", line 20, in <module>
from cupy import core # NOQA
File "C:\ProgramData\Anaconda3\lib\site-packages\cupy\core\__init__.py", line 1, in <module>
from cupy.core import core # NOQA
File "cupy\core\core.pyx", line 1, in init cupy.core.core
File "C:\ProgramData\Anaconda3\lib\site-packages\cupy\cuda\__init__.py", line 5, in <module>
from cupy.cuda import compiler # NOQA
File "C:\ProgramData\Anaconda3\lib\site-packages\cupy\cuda\compiler.py", line 14, in <module>
from cupy_backends.cuda.libs import nvrtc
ImportError: DLL load failed: The specified module could not be found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<ipython-input-1-e011b0e859cc>", line 1, in <module>
import cupy as cp
File "C:\ProgramData\Anaconda3\lib\site-packages\cupy\__init__.py", line 41, in <module>
raise ImportError(_msg) from e
ImportError: CuPy is not correctly installed.
If you are using wheel distribution (cupy-cudaXX), make sure that the version of CuPy you installed matches with the version of CUDA on your host.
Also, confirm that only one CuPy package is installed:
$ pip freeze
If you are building CuPy from source, please check your environment, uninstall CuPy and reinstall it with:
$ pip install cupy --no-cache-dir -vvvv
Check the Installation Guide for details:
https://docs.cupy.dev/en/latest/install.html
original error: DLL load failed: The specified module could not be found.
I just upgraded to Pop OS(Ubuntu) 20.04, which upgraded Python 3.7 to 3.8. Now I get this error below when I run sam (from the AWS SAM CLI). Solutions found online all had to do with making sure python3-distutils is installed. I have verified that python3-disutils is installed. /usr/lib/python3.8/distutils looks fine, just not getting picked up for some reason.
One thing I noticed is that in the traceback below, it's using the system-wide pip, while I have a later version of pip installed under my .local. I don't know if those two symptoms are related but looks like I'm missing some config somewhere so none of the 3.8 or user space stuff is picked up.
Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pip/_internal/main.py", line 14, in main
from pip._internal.utils.entrypoints import _wrapper
File "/usr/lib/python3/dist-packages/pip/_internal/utils/entrypoints.py", line 3, in <module>
from pip._internal.cli.main import main
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
I have the same issue on Debian Bullseye (or rather mixed Bullseye/Buster).
Package python3-distutils (3.8.6) contains module for Python 3.8 and 3.9 (!).
Old package (3.7.3) for Python 3.7. You have to choose.
My workaround is just copy module.
mkdir -p /usr/lib/python3.7/distutils
cp -a /usr/lib/python3.8/distutils/* /usr/lib/python3.7/distutils/
When running django projects with python3 or installing modules with pip, I am getting google-appengine errors, even if my project is not using google appengine.
When running pip3 freeze I get the following results:
andrew#andrew:~/dev/quickistock$ pip3 freeze
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/home/andrew/.local/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/andrew/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 23, in <module>
from pip.locations import (
File "/home/andrew/.local/lib/python3.5/site-packages/pip/locations.py", line 10, in <module>
from distutils.command.install import install, SCHEME_KEYS # noqa
File "/usr/local/google-cloud-sdk/platform/google_appengine/lib/distutils/distutils/command/install.py", line 258
raise DistutilsOptionError, \
^
SyntaxError: invalid syntax
The file usr/local/google-cloud-sdk/platform/google_appengine/lib/distutils/distutils/command/install.py has lines like this and is compatible with python 2.1. Note. this is not the official google repository but it's accurate:
print "config vars:"
This means that install.py is a python 2 file and you are running pip from python 3. There probably is some incompatibility between them.
i am trying to use of systrace. for this, i am reading official site.
but after run this command on terminal :
D:\Software\Android\android-sdk\platform-tools\systrace>python systrace.py --time=10 -o mynewtrace.html sched gfx view wm
I got these error:
Traceback (most recent call last):
File "systrace.py", line 48, in <module>
from systrace import run_systrace
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 40, in <module>
from devil import devil_env
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\devil_env.py", line 32, in <module>
import dependency_manager # pylint: disable=import-error
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\__init__.py", line 28, in <module>
from .archive_info import ArchiveInfo
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\archive_info.py", line 7, in <module>
from dependency_manager import exceptions
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\exceptions.py", line 5, in <module>
from py_utils import cloud_storage
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\common\py_utils\py_utils\cloud_storage.py", line 20, in <module>
from py_utils import lock
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\common\py_utils\py_utils\lock.py", line 18, in <module>
import win32con # pylint: disable=import-error
ImportError: No module named win32con
my python version:
D:\Software\Android\android-sdk\platform-tools\systrace>python --version
Python 2.7.13
D:\Software\Android\android-sdk\platform-tools\systrace>
I have added python PATH to ** system ENVIRONMENT** . my main goal of use Systrace by command is using of Tracing Application Code. I put:
Trace.beginSection("MyAdapter.onCreateViewHolder");
and
Trace.endSection();
to my code and i want to see this output as a trace to systrace by -a or --app= options.
GUI systrace is ok on google chrome and work excellent in this browser.
python doesn't come with pywin32 library. you just need to download pywin32 version according to your system from here https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/ and install it. It will work.
For me, running
pip install pypiwin32
fixed the problem
My error stacktrace
C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace>python
systrace.py --time=10 -o my_systrace.html Traceback (most recent call
last): File "systrace.py", line 48, in <module>
from systrace import run_systrace File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py",
line 43, in <module>
from systrace import systrace_runner File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\systrace_runner.py",
line 11, in <module>
from systrace import output_generator File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\output_generator.py",
line 15, in <module>
from tracing.trace_data import trace_data File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\tracing\tracing\trace_data\trace_data.py",
line 17, in <module>
import six ImportError: No module named six
I solved the problem:
pip install six
summary
find ImportError what, use pip install it
In Windows10 when running through the command line, I got the same errors!
But if run systrace from Android Device Monitor all work fine!
To do this:
run Android Device Monitor
click DDMS icon
in the "Devices" tab select your device
click "Capture system wide trace using Android systrace" (Near the icon " Screen Capture")
I use Android Device Monitor Version: 25.2.2
In my case I was using Python 3.8, I just switched to 2.7.
I am using python 2.7 win 32
I need to install openslide in python
in below page show
Install openslide
http://openslide.org/download/
which item download for windows.
i tried every thing.and pip installation
the error shows below
import openslide
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import openslide
File "C:\Python27\lib\site-packages\openslide\__init__.py", line 29, in >>>> <module>
from openslide import lowlevel
File "C:\Python27\lib\site-packages\openslide\lowlevel.py", line 41, in <module>
_lib = cdll.LoadLibrary('libopenslide-0.dll')
File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
Thanks
This question may be old, but perhaps an answer will help a future viewer.
To fix this error, you need to download the openslide binaries at http://openslide.org/download/ look under (Windows Binaries)
Next, add the location of the bin folder to your system path (this will allow python to know where the module is). And that should solve the problem.
Install instructions found here: https://pypi.python.org/pypi/openslide-python