libxslt error: lxml on Docker python:3.6.5-alpine3.7 - python-3.x

I've installed the dependences using apk add libxslt-dev libxml2-dev for pip install lxml successfully, but encountering error with
...
Successfully built e6d5e3a0d74b
Successfully tagged 172.16.3.191:5000/spider/parse:1.2
[root#docker-191 Parse]# docker run -p 1000:10002 172.16.3.191:5000/spider/parse:1.2
Traceback (most recent call last):
File "parse.py", line 1, in <module>
from parsel.selector import Selector
File "/usr/local/lib/python3.6/site-packages/parsel/__init__.py", line 10, in <module>
from parsel.selector import Selector, SelectorList # NOQA
File "/usr/local/lib/python3.6/site-packages/parsel/selector.py", line 8, in <module>
from lxml import etree, html
ImportError: Error loading shared library libxslt.so.1: No such file or directory (needed by /usr/local/lib/python3.6/site-packages/lxml/etree.cpython-36m-x86_64-linux-gnu.so)
when I run my app.
I don't know what is the matter with Docker image alpine3.7 or python 3.6.5 or python:3.6.5-alpine3.7?
What should I do? Can someone help me? Thanks.

Related

CuPy import failing due to missing DLL file although it appears in my directories

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.

How to install ifxpy module in docker image python3.6

Hi have created a docker image with base image python3.6
I have installed ifxpy using "pip install ifxpy" and after successful build ifxpy-3.0.1 I tried to import ifxpy lib and it gives me the error
Successfully built flask-jwt idna-ssl
Installing collected packages: click,
ifxpy-3.0.1 itsdangerous-1.1.0 multidict-4.5.2 pytz-2019.1 requests-2.22.0 schedule-0.6.0 typing-extensions-3.7.4 urllib3-1.25.3 yarl-1.3.0
Error logs from docker :-
Traceback (most recent call last):
File "/home/pythonuser/Informix_Conn.py", line 3, in <module>
import IfxPyDbi as dbapi2
File "/usr/local/lib/python3.6/site-packages/IfxPyDbi.py", line 43, in <module>
import IfxPy
ImportError: libifdmr.so: cannot open shared object file: No such file or directory
libifdmr.so is a library of the Informix Client SDK.
So first install the Informix Client SDK. Furthermore you have to set the enviroment variable LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/cli.

python3 path only running google-appengine modules

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.

Python3.4 - Install pyautogui - Raspberry Pi 3

I've been trying to install pyautogui for Python 3.4 on my Raspberry Pi 3 for the last 2 hours... I need it because I wrote a touch keyboard application that needs to run on it. On my main machine (elementary OS 0.4 with Python 3.5) I was able to install it without any problems. First I tried sudo pip install pyautogui but that only installed the Python 2.7 version of pyautogui. Of course next I tried sudo pip3 install pyautogui but that gave me this error:
Running setup.py (path:/tmp/pip-build-hf289jja/pyautogui/setup.py) egg_info for package pyautogui
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-hf289jja/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/__init__.py", line 114, in <module>
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/_pyautogui_x11.py", line 6, in <module>
from Xlib.display import Display
File "/usr/local/lib/python3.4/dist-packages/Xlib/display.py", line 20, in <module>
import new
ImportError: No module named 'new'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 17, in
File "/tmp/pip-build-hf289jja/pyautogui/setup.py", line 6, in
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/init.py", line 114, in
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/_pyautogui_x11.py", line 6, in
from Xlib.display import Display
File "/usr/local/lib/python3.4/dist-packages/Xlib/display.py", line 20, in
import new
ImportError: No module named 'new'
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-hf289jja/pyautogui
Storing debug log for failure in /root/.pip/pip.log
... sorry for the formatting of the above, I couldn't get it to stay inside one code box.
I have no idea what module "new" is. I tried everything else under the sun, such as installing from the official resources: https://pypi.python.org/pypi/PyAutoGUI and various other guides, with NO results.. I'm kinda loosing my mind right now.
ANY Help is grately appreciated :)
Try the following:
sudo pip3 install python3-xlib
sudo pip3 install pyautogui
This assumes you have some other python3 libraries already installed, but you will see missing installs in the above if not.

installed tesserocr(python) can't see leptonica

I have installed leptonica and tesseract in $HOME/local and tesseract is working properly, then tesserocr python package with:
CPPFLAGS="-I/home/user/local/include /home/user/local/lib" pip install tesserocr
and when I want to invoke it I get this:
$ python3 extract.py
Traceback (most recent call last):
File "extract.py", line 4, in <module>
from tesserocr import PyTessBaseAPI, RIL, PyLTRResultIterator, iterate_level
ImportError: liblept.so.5: cannot open shared object file: No such file or directory
please help
As mentioned in my comment on the original post, the proper installation command should be:
CPPFLAGS="-I/home/user/local/include -L/home/user/local/lib" pip install tesserocr

Resources