Google App Engine rtree Python Module Installation - python

Google App Engine, does not include libspatialindex, and hence I am unable to install rtree python module, even if it is in requirements.txt,
it gives following error, while deploying app. ( app works fine locally. ) How do I install specific lib in python standard google app engine environment ? or How do I request them to do so ?
Collecting rtree
Downloading Rtree-0.9.4.tar.gz (62 kB)
ERROR: Command errored out with exit status 1:
command: /opt/python3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hl9513g_/rtree/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hl9513g_/rtree/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-0tyv4fij
cwd: /tmp/pip-install-hl9513g_/rtree/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-hl9513g_/rtree/setup.py", line 3, in <module>
import rtree
File "/tmp/pip-install-hl9513g_/rtree/rtree/__init__.py", line 1, in <module>
from .index import Rtree
File "/tmp/pip-install-hl9513g_/rtree/rtree/index.py", line 6, in <module>
from . import core
File "/tmp/pip-install-hl9513g_/rtree/rtree/core.py", line 143, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/opt/python3.8/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
func = self.__getitem__(name)
File "/opt/python3.8/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /opt/python3.8/bin/python3: undefined symbol: Error_GetLastErrorNum
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

You will need to use flexible environment with custom runtime to utilize packages not preinstalled in standard environment.
To install libspatialindex, add this to the Dockerfile:
sudo apt-get update -y
sudo apt-get install -y libspatialindex-dev

Related

Installing devpi-client 4.1.0 fails in python2 virtual environment

Running pip install devpi-client==4.1.0 in python2 virtual environment fails with below Installing build dependencies ... error:
ERROR: Command errored out with exit status 1:
command: /private/tmp/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/72/91vhtwlx2v577_2t46dkm6yh0000gq/T/pip-install-Owjkqu/setuptools/setup.py'"'"'; __file__='"'"'/private/var/folders/72/91vhtwlx2v577_2t46dkm6yh0000gq/T/pip-install-Owjkqu/setuptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/72/91vhtwlx2v577_2t46dkm6yh0000gq/T/pip-pip-egg-info-357GNw
cwd: /private/var/folders/72/91vhtwlx2v577_2t46dkm6yh0000gq/T/pip-install-Owjkqu/setuptools/
Complete output (10 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "setuptools/version.py", line 1, in <module>
import pkg_resources
File "pkg_resources/__init__.py", line 1365
raise SyntaxError(e) from e
^
SyntaxError: invalid syntax
-----------------------------
Above the error there are lines Collecting setuptools>=42 Downloading .../setuptools-51.1.1.tar.gz (2.1 MB)
setuptools 51.1.1 require minimum python3.6, so it probably explains the syntax error.
Is there a way to force the package to use existing setuptools version or specify which version to use during build dependencies installation?

Problems installing django-observer package

Hello I am trying to install django-observer for python3 on my Win10 PC but I keep getting following error message:
Collecting django-observer
Using cached django-observer-0.4.3.tar.gz (7.4 kB)
Requirement already satisfied: django>=1.2 in c:\users\luca dieling\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from django-observer) (3.1.4)
Collecting distribute
Using cached distribute-0.7.3.zip (145 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Luca Dieling\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Luca Dieling\\AppData\\Local\\Temp\\pip-install-k757dx1_\\distribute_c11e8be23eda49c7809d38d8e88b222e\\setup.py'"'"'; __file__='"'"'C:\\Users\\Luca Dieling\\AppData\\Local\\Temp\\pip-install-k757dx1_\\distribute_c11e8be23eda49c7809d38d8e88b222e\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Luca Dieling\AppData\Local\Temp\pip-pip-egg-info-00os3tdp'
cwd: C:\Users\Luca Dieling\AppData\Local\Temp\pip-install-k757dx1_\distribute_c11e8be23eda49c7809d38d8e88b222e\
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Luca Dieling\AppData\Local\Temp\pip-install-k757dx1_\distribute_c11e8be23eda49c7809d38d8e88b222e\setuptools\__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "C:\Users\Luca Dieling\AppData\Local\Temp\pip-install-k757dx1_\distribute_c11e8be23eda49c7809d38d8e88b222e\setuptools\extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "C:\Users\Luca Dieling\AppData\Local\Temp\pip-install-k757dx1_\distribute_c11e8be23eda49c7809d38d8e88b222e\setuptools\dist.py", line 7, in <module>
from setuptools.command.install import install
File "C:\Users\Luca Dieling\AppData\Local\Temp\pip-install-k757dx1_\distribute_c11e8be23eda49c7809d38d8e88b222e\setuptools\command\__init__.py", line 8, in <module>
from setuptools.command import install_scripts
File "C:\Users\Luca Dieling\AppData\Local\Temp\pip-install-k757dx1_\distribute_c11e8be23eda49c7809d38d8e88b222e\setuptools\command\install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "C:\Users\Luca Dieling\AppData\Local\Temp\pip-install-k757dx1_\distribute_c11e8be23eda49c7809d38d8e88b222e\pkg_resources.py", line 1518, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I am running the command pip install django-observer
Thank you for your help
This django-observer package hasn't been maintained for a long time. The github repository states it works on Python 3 version 3.2 and 3.3 though. So you might have luck setting up a virtualenv with python 3.2 or 3.3 and working from there.
The package appears to have done work similar to that of Django Signals. You can read up on them here. Signals are an implementation of the Observer pattern.
Just FYI, I tried installing the package too and got the same error on my MacOS machine. This is why I suggest switching to Signals.

Issue with installing causalml package python

I am trying to install the package causalml in Jupyter using pip, and I get the following error:
ERROR: Command errored out with exit status 1:
command: /opt/conda/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h3qf0rqq/causalml_92ba9279cfbd4f77ac1f50f04998c187/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h3qf0rqq/causalml_92ba9279cfbd4f77ac1f50f04998c187/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-m0xr_f2v
cwd: /tmp/pip-install-h3qf0rqq/causalml_92ba9279cfbd4f77ac1f50f04998c187/
Complete output (20 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-h3qf0rqq/causalml_92ba9279cfbd4f77ac1f50f04998c187/setup.py", line 56, in <module>
ext_modules=cythonize(extensions),
File "/opt/conda/lib/python3.6/site-packages/Cython/Build/Dependencies.py", line 962, in cythonize
ctx = c_options.create_context()
File "/opt/conda/lib/python3.6/site-packages/Cython/Compiler/Main.py", line 597, in create_context
self.cplus, self.language_level, options=self)
File "/opt/conda/lib/python3.6/site-packages/Cython/Compiler/Main.py", line 80, in __init__
from . import Builtin, CythonScope
File "/opt/conda/lib/python3.6/site-packages/Cython/Compiler/CythonScope.py", line 5, in <module>
from .UtilityCode import CythonUtilityCode
File "/opt/conda/lib/python3.6/site-packages/Cython/Compiler/UtilityCode.py", line 3, in <module>
from .TreeFragment import parse_from_strings, StringParseContext
File "/opt/conda/lib/python3.6/site-packages/Cython/Compiler/TreeFragment.py", line 17, in <module>
from .Visitor import VisitorTransform
File "Cython/Compiler/Visitor.py", line 17, in init Cython.Compiler.Visitor
File "/opt/conda/lib/python3.6/site-packages/Cython/Compiler/ExprNodes.py", line 46, in <module>
from .Pythran import (to_pythran, is_pythran_supported_type, is_pythran_supported_operation_type,
ImportError: cannot import name 'pythran_is_numpy_func_supported'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
In another forum, I read that this is a cython issue, I have uninstalled and reinstalled it, and it did not work out. I am working with Python 3.6.10, and here are the versions of the dependent packages on my system.
setuptools= 50.3.0
pip=20.3
numpy=1.18.5
scipy=1.4.1
matplotlib
pandas=1.1.2
scikit-learn=0.23.2
statsmodels=0.12.0
seaborn
Cython=0.29.21
xgboost
pydotplus
tqdm
shap
dill
lightgbm
pygam
packaging
keras
tensorflow=2.3.0
I checked the dependency requirements, and I believe all the above packages are acceptable for installing causalml. I also tried cloning the git repo and installing it, and I got the same error. Your feedback and suggestion are greatly appreciated.

How to install python ta-lib library in Azure Machine Learning Juypyter Notebooks

SO I need to use this python library explained here:
https://medium.com/analytics-vidhya/recognizing-over-50-candlestick-patterns-with-python-4f02a1822cb5
However when I try to execute:
!pip install talib
import talib
I get lots of errors:
Collecting talib
Using cached talib-0.1.1.tar.gz (1.3 kB)
Building wheels for collected packages: talib
Building wheel for talib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /anaconda/envs/azureml_py36/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lof3_wuc/talib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lof3_wuc/talib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-1dvr6fd9
cwd: /tmp/pip-install-lof3_wuc/talib/
Complete output (29 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/talib
copying talib/__init__.py -> build/lib/talib
copying talib/cli.py -> build/lib/talib
installing to build/bdist.linux-x86_64/wheel
running install
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-lof3_wuc/talib/setup.py", line 47, in <module>
'talib = talib.cli:cli',
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 326, in run
self.run_command('install')
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-lof3_wuc/talib/setup.py", line 20, in run
raise Exception("You probably meant to install and run ta-lib")
Exception: You probably meant to install and run ta-lib
----------------------------------------
ERROR: Failed building wheel for talib
Running setup.py clean for talib
Failed to build talib
Installing collected packages: talib
Running setup.py install for talib ... error
ERROR: Command errored out with exit status 1:
command: /anaconda/envs/azureml_py36/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lof3_wuc/talib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lof3_wuc/talib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-7fqjayvz/install-record.txt --single-version-externally-managed --compile --install-headers /anaconda/envs/azureml_py36/include/python3.6m/talib
cwd: /tmp/pip-install-lof3_wuc/talib/
Complete output (14 lines):
running install
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-lof3_wuc/talib/setup.py", line 47, in <module>
'talib = talib.cli:cli',
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/anaconda/envs/azureml_py36/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-lof3_wuc/talib/setup.py", line 20, in run
raise Exception("You probably meant to install and run ta-lib")
Exception: You probably meant to install and run ta-lib
----------------------------------------
ERROR: Command errored out with exit status 1: /anaconda/envs/azureml_py36/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lof3_wuc/talib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lof3_wuc/talib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-7fqjayvz/install-record.txt --single-version-externally-managed --compile --install-headers /anaconda/envs/azureml_py36/include/python3.6m/talib Check the logs for full command output.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-56-ef2dd36041a5> in <module>
1 get_ipython().system('pip install talib')
----> 2 import talib
ModuleNotFoundError: No module named 'talib'
#phd is right. the TA-lib Python library's README.md's says
To use TA-Lib for python, you need to have the TA-Lib already installed.
I just created a new AML Compute Instance and was able to successfully import TA-lib for Python after first manually downloading, building and installing the TA-lib package on the VM. Some steps took around 5 min but YMMV
To install on the Azure ML Compute Instance.
Open the Compute Instance in Jupyter Labs
Open a new Terminal (File:New:Terminal)
Type the following commands (adapted from these linux instructions)
$ wget -c https://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download?use_mirror=phoenixnap -O - | tar -xz
$ cd ta-lib/
$ ./configure --prefix=/usr
$ make
$ sudo make install
install TA-lib Python wrapper pip install TA-lib (I had to do this twice for some reason)
open a notebook and run a cell with import talib
. your error means that you don't have the TA-lib back

Install mysqlclient for Django database via pip

I have installed MySQL-server, python3-dev, libmysqlclient-dev. But whem I try to install mysqlclient via pip, I get some errors that I don't understand. Like this:
(Env) randomparatololer#randomparatololer:~/Documents/DJANGO/tigabelas$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
ERROR: Command errored out with exit status 1:
command: /home/randomparatololer/Documents/DJANGO/Env/bin/python3.8 -C 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r_ybnapl/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r_ybnapl/mysqlclient/setup.py'"'"';f=getattr (tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace ('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec (compile (code, __file__, '"'"'exec'"'"')' egg_info – egg-base /tmp/pip-install-r_ybnapl/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-r_ybnapl/mysqlclient/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/randomparatololer/Documents/DJANGO/Env/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
from setuptools.dist import Distribution, Feature
File "/home/randomparatololer/Documents/DJANGO/Env/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
from setuptools import windows_support
File "/home/randomparatololer/Documents/DJANGO/Env/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: Python setup.py egg_info Check the logs for full command output.

Categories