pip install pymssql from inside docker container - docker

My docker container is using centos6.6. It fails to pip install pymssql:
Step 15 : RUN pip install pymssql
---> Running in c6a17c43790d
Collecting pymssql
Downloading http://piprepo-au/piprepo/pymssql/pymssql-2.1.1.zip (2.3MB)
Installing collected packages: pymssql
Running setup.py install for pymssql: started
Running setup.py install for pymssql: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-6Tr3gO/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-DZY29I-record/install-record.txt --single-version-externally-managed --compile:
setup.py: platform.system() => 'Linux'
setup.py: platform.architecture() => ('64bit', '')
setup.py: platform.linux_distribution() => ('CentOS', '6.6', 'Final')
setup.py: platform.libc_ver() => ('glibc', '2.3')
setup.py: Not using bundled FreeTDS
setup.py: include_dirs = ['/usr/local/include']
setup.py: library_dirs = ['/usr/local/lib']
running install
running build
running build_ext
cythoning _mssql.pyx to _mssql.c
Error compiling Cython file:
------------------------------------------------------------
...
return uuid.UUID(bytes_le=(<char *>data)[:length])
else:
return (<char *>data)[:length]
cdef int convert_python_value(self, object value, BYTE **dbValue,
^
------------------------------------------------------------
_mssql.pyx:821:9: Signature not compatible with previous declaration
Error compiling Cython file:
------------------------------------------------------------
...
cdef object msghandler
cpdef cancel(self)
cdef void clear_metadata(self)
cdef object convert_db_value(self, BYTE *, int, int)
cdef int convert_python_value(self, object value, BYTE **, int*, int*) except -1
Has anyone got any ideas? I have tried quite alot of things.
I didnt have this problem on ubuntu16.
.
.
.

It appears that this is caused by an interface change somewhere between versions 2.1.1 and 2.1.3 of pymssql. I didn't have time to investigate the exact reason but after noticing the problem persisted on a centos 7.x docker image I was able to resolve this problem by installing a newer version of pymssql:
pip install pymssql==2.1.3

Related

How to launch Jupyter with custom extension using a docker

I am trying to launch, via docker, a jupyterlab with a custom extension(extensionTest). However, I haven't been successful.
Can someone tell me how can i do it? Or put here an example?
What is the best base docker image to use?
Thank you
Best regards
I tried doing this dockerfile, but is not working :
FROM jupyter/minimal-notebook:lab-3.2.3
RUN pip install --no-cache-dir \
astropy \
ipytree \
ipywidgets \
jupyter \
numpy \
poliastro
RUN jupyter labextension install \
jupyterlab-plotly#4.14.2 \
plotlywidget#4.14.2
RUN pip install jupyterlab_widgets
COPY ./extensions/ ./extensions/
WORKDIR ./extensions/
RUN python -m pip install ./extensionTest
RUN jupyter labextension extensionTest
ENTRYPOINT start.sh jupyter lab
Thanks
Error that I get :
ERROR: Command errored out with exit status 1:
command: /opt/conda/bin/python /opt/conda/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp2m0biqur
cwd: /home/jovyan/extensions/extensionTest
Complete output (44 lines):
INFO:hatch_jupyter_builder.utils:Running jupyter-builder
INFO:hatch_jupyter_builder.utils:Building with hatch_jupyter_builder.npm_builder
INFO:hatch_jupyter_builder.utils:With kwargs: {'build_cmd': 'build:prod', 'npm': ['jlpm']}
INFO:hatch_jupyter_builder.utils:Installing build dependencies with npm. This may take a while...
INFO:hatch_jupyter_builder.utils:> /tmp/pip-build-env-gj35ixm0/overlay/bin/jlpm install
yarn install v1.21.1
info No lockfile found.
[1/4] Resolving packages...
warning #jupyterlab/application > #jupyterlab/apputils > url > querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning #jupyterlab/application > #jupyterlab/ui-components > #blueprintjs/core > popper.js#1.16.1: You can find the new Popper v2 at #popperjs/core, this package is dedicated to the legacy v1
warning #jupyterlab/application > #jupyterlab/ui-components > #blueprintjs/core > react-popper > popper.js#1.16.1: You can find the new Popper v2 at #popperjs/core, this package is dedicated to the legacy v1
warning #jupyterlab/builder > terser-webpack-plugin > cacache > #npmcli/move-file#1.1.2: This functionality has been moved to #npmcli/fs
warning #jupyterlab/builder > #jupyterlab/buildutils > crypto#1.0.1: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
warning #jupyterlab/builder > #jupyterlab/buildutils > verdaccio > request#2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
warning #jupyterlab/builder > #jupyterlab/buildutils > verdaccio > request > har-validator#5.1.5: this library is no longer supported
warning #jupyterlab/builder > #jupyterlab/buildutils > verdaccio > request > uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
[2/4] Fetching packages...
warning #blueprintjs/core#3.54.0: Invalid bin entry for "upgrade-blueprint-2.0.0-rename" (in "#blueprintjs/core").
warning #blueprintjs/core#3.54.0: Invalid bin entry for "upgrade-blueprint-3.0.0-rename" (in "#blueprintjs/core").
error lib0#0.2.58: The engine "node" is incompatible with this module. Expected version ">=14". Got "12.4.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/opt/conda/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/opt/conda/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-gj35ixm0/overlay/lib/python3.9/site-packages/hatchling/build.py", line 41, in build_wheel
return os.path.basename(next(builder.build(wheel_directory, ['standard'])))
File "/tmp/pip-build-env-gj35ixm0/overlay/lib/python3.9/site-packages/hatchling/builders/plugin/interface.py", line 136, in build
build_hook.initialize(version, build_data)
File "/tmp/pip-build-env-gj35ixm0/normal/lib/python3.9/site-packages/hatch_jupyter_builder/plugin.py", line 83, in initialize
raise e
File "/tmp/pip-build-env-gj35ixm0/normal/lib/python3.9/site-packages/hatch_jupyter_builder/plugin.py", line 78, in initialize
build_func(self.target_name, version, **build_kwargs)
File "/tmp/pip-build-env-gj35ixm0/normal/lib/python3.9/site-packages/hatch_jupyter_builder/utils.py", line 114, in npm_builder
run(npm_cmd + ["install"], cwd=str(abs_path))
File "/tmp/pip-build-env-gj35ixm0/normal/lib/python3.9/site-packages/hatch_jupyter_builder/utils.py", line 227, in run
return subprocess.check_call(cmd, **kwargs)
File "/opt/conda/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/tmp/pip-build-env-gj35ixm0/overlay/bin/jlpm', 'install']' returned non-zero exit status 1.
So, to anyone interested i was able to create a docker file that builds and run you jupyter extension. My code is this:
FROM node:14 AS build-env
RUN apt-get update && \
apt-get install -y python3-pip && \
pip3 install jupyterlab
COPY Path/to/Extension Path/to/Extension
WORKDIR Path/to/extension
RUN yarn install && yarn build && yarn run build
FROM jupyter/minimal-notebook:lab-3.2.3
RUN pip install --no-cache-dir \
astropy \
ipytree \
ipywidgets \
jupyter \
numpy \
poliastro
RUN jupyter labextension install \
jupyterlab-plotly#4.14.2 \
#jupyter-widgets/jupyterlab-manager \
plotlywidget#4.14.2
COPY --from=build-env Path/to/Extension/on/Nodejs Path/to/Extension
RUN jupyter labextension install Path/to/Extension
If someone knows something that can be simplified, let me know :)

Could not find HDF5 installation for PyTables on M1 Mac

Running on M1 Mac, macOS Monterey 12.4, Python 3.10.3
pip install tables
Collecting tables
Using cached tables-3.7.0.tar.gz (8.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
/var/folders/6g/9c7g_2tx2sb7lp8ttwtfky640000gn/T/H5closew_79lujq.c:2:5: error: implicit declaration of function 'H5close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
H5close();
^
1 error generated.
cpuinfo failed, assuming no CPU features: No module named 'cpuinfo'
* Using Python 3.10.3 (v3.10.3:a342a49189, Mar 16 2022, 09:34:18) [Clang 13.0.0 (clang-1300.0.29.30)]
* Found cython 0.29.30
* USE_PKGCONFIG: False
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and
library can be found by setting the ``HDF5_DIR`` environment
variable or by using the ``--hdf5`` command-line option.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I tried the following from this GitHub Issue:
pip install cython
brew install hdf5
brew install c-blosc
export HDF5_DIR=/usr/local/
export BLOSC_DIR=/usr/local/
pip install tables
But still getting the same error. Not sure if it's due to Homebrew using a different path on M1 Macs?
The issue is that Homebrew puts the files in opt/homebrew/opt/
This fixed it for me:
export HDF5_DIR=/opt/homebrew/opt/hdf5
export BLOSC_DIR=/opt/homebrew/opt/c-blosc
Again in completion to remove confusion. Running the following in terminal on Mac M1 should work.
pip install cython
brew install hdf5
brew install c-blosc
export HDF5_DIR=/opt/homebrew/opt/hdf5
export BLOSC_DIR=/opt/homebrew/opt/c-blosc
pip install tables
A solution from here solved the issue for me:
https://github.com/freqtrade/freqtrade/issues/4162
Scroll down and see "solution" provided by camxus

how to solve the glm problem when installing pymol?

I am trying to install pymol in CentOS 7 system. I installed the dependency glm-devel-0.9.6.3-1.el7.noarch by yum:
sudo yum install glm-devel.
During compiling I got an error related to glm as following:
layer1/SceneView.cpp:34:61: error: no matching function for call to ‘equal(const vec3&, const vec3&, float)’
Could anyone tell why this error appears?
I will appreciate any help!
Best regards.
install pymol in CentOS 7
Build example with updated glm-devel
# yum install mmtf-cpp-devel.x86_64 glew-devel.x86_64 libpng-devel freetype-devel msgpack-devel libxml2-devel python36-qt5-devel.x86_64 freeglut-devel mesa-libGL-devel.x86_64 python3-devel
# yum install ./glm-devel-0.9.9.6-6.el7.noarch.rpm
## works with the default python3 (3.6.8) and g++ -4.8.5
Link, glm-devel-0.9.9.6-6.el7 https://drive.google.com/file/d/1BXygEWqpvlbZg867dsXuW47T67Z0V0Q8/view?usp=sharing
https://github.com/schrodinger/pymol-open-source →
https://github.com/schrodinger/pymol-open-source/blob/master/INSTALL
git clone https://github.com/schrodinger/pymol-open-source.git
cd pymol-open-source/
python3 setup.py build
# python3 setup.py install
pymol ## the pymol GUI opens OK
There is also a binary version available, with python 3.7 included : https://pymol.org/2/ →
https://pymol.org/installers/PyMOL-2.5.2_293-Linux-x86_64-py37.tar.bz2 → tar xvf PyMOL-2.5.2_293-Linux-x86_64-py37.tar.bz2
cd pymol/ && ./pymol

Installing python module in Robomaker ROS workspace with colcon

I'm working on a cloud-based robotic application with AWS RoboMaker. I'm using ROS Kinetic, with the build tool colcon.
My robot application depends on a custom python module, which has to be in my workspace. This python module is built by colcon as a python package, not a ROS package. This page explains how to do that with catkin, but this example shows how to adapt it to colcon. So finally my workspace looks like that :
my_workspace/
|--src/
|--my_module/
| |--setup.py
| |--package.xml
| |--subfolders and python scripts...
|--some_ros_pkg1/
|--some_ros_pkg2/
|...
However the command : colcon build <my_workspace> builds all ROS packages but fails to build my python module as a package.
Here's the error I get :
Starting >>> my-module
[54.297s] WARNING:colcon.colcon_ros.task.ament_python.build:Package 'my-module' doesn't explicitly install a marker in the package index (colcon-ros currently does it implicitly but that fallback will be removed in the future)
[54.298s] WARNING:colcon.colcon_ros.task.ament_python.build:Package 'my-module' doesn't explicitly install the 'package.xml' file (colcon-ros currently does it implicitly but that fallback will be removed in the future)
--- stderr: my-module
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'egg_info'
---
Failed <<< my-module [0.56s, exited with code 1]
I found this issue that seems correlated, and thus tried : pip install --upgrade setuptools
...Which fails with the error message :
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/7c/1b/9b68465658cda69f33c31c4dbd511ac5648835680ea8de87ce05c81f95bf/setuptools-50.3.0.zip
Complete output from command python setup.py egg_info:
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
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-uwFamt/setuptools/
And with pip3 install --upgrade setuptools, I get :
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: setuptools in /home/ubuntu/.local/lib/python3.5/site-packages (50.3.0)
I have both Python 3.5.2 an Python 2.7, but I don't know which one is used by colcon.
So I don't know what to try next, and what the real problem is. Any help welcome !
I managed to correctly install my package and its dependencies. I develop the method below, in case it may help someone someday !
I have been mainly inspired by this old DeepRacer repository.
The workspace tree in the question is wrong. It should look like this:
my_workspace/
|--src/
|--my_wrapper_package/
| |--setup.py
| |--my_package/
| |--__init__.py
| |--subfolders and python scripts...
|--some_ros_pkg1/
|--some_ros_pkg2/
my_wrapper_package may contain more than one python custom package.
A good setup.py example is this one.
You shouldn't put a package.xml next to setup.py : colcon will only look at the dependencies declared in package.xml, and won't collect pip packages.
It may help sometimes to delete the folders my_wrapper_package generated by colcon in install/ and build/. Doing so you force colcon to rebuild and bundle from scratch.

apk add cmake>3.12-suffix not working on alpine docker

I am trying to install Xgboost on an Alpine docker
I was receiving this message:
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.12 or higher is required. You are running version 3.9.5
then I added the following line before
RUN apk add cmake>3.12-suffix
# RUN pip install cmake
RUN pip3 install xgboost
and I am still getting the following error message.
What am I doing wrong ?
> Step 16/21 : RUN apk add cmake>3.12-suffix
---> Using cache
---> da84d6ee0868
Step 17/21 : RUN pip3 install xgboost
---> Running in c8e77045ea59
Collecting xgboost
Downloading xgboost-1.0.2.tar.gz (821 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9m5q6l5k/xgboost/setup.py'"'"';
__file__='"'"'/tmp/pip-install-9m5q6l5k/xgboost/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-9m5q6l5k/xgboost/pip-egg-info
cwd: /tmp/pip-install-9m5q6l5k/xgboost/
Complete output (35 lines):
+ pwd
+ oldpath=/tmp/pip-install-9m5q6l5k/xgboost
+ cd ./xgboost/
+ mkdir -p build
+ cd build
+ cmake ..
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.12 or higher is required. You are running version 3.9.5
-- Configuring incomplete, errors occurred!
+ echo -----------------------------
-----------------------------
+ echo Building multi-thread xgboost failed
Building multi-thread xgboost failed
+ echo Start to build single-thread xgboost
Start to build single-thread xgboost
+ cmake .. -DUSE_OPENMP=0
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.12 or higher is required. You are running version 3.9.5
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-9m5q6l5k/xgboost/setup.py", line 42, in <module>
LIB_PATH = libpath['find_lib_path']()
File "/tmp/pip-install-9m5q6l5k/xgboost/xgboost/libpath.py", line 50, in find_lib_path
'List of candidates:\n' + ('\n'.join(dll_path)))
XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
/tmp/pip-install-9m5q6l5k/xgboost/xgboost/libxgboost.so
/tmp/pip-install-9m5q6l5k/xgboost/xgboost/../../lib/libxgboost.so
/tmp/pip-install-9m5q6l5k/xgboost/xgboost/./lib/libxgboost.so
/usr/xgboost/libxgboost.so
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Resources