FROM ubuntu:14.04.2
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get -y update && apt-get upgrade -y
RUN apt-get install python build-essential python-dev python-pip python-setuptools -y
RUN apt-get install libxml2-dev libxslt1-dev python-dev -y
RUN apt-get install libpq-dev postgresql-common postgresql-client -y
RUN apt-get install openssl openssl-blacklist openssl-blacklist-extra -y
RUN apt-get install nginx -y
RUN pip install "pip>=7.0"
RUN pip install virtualenv uwsgi
ADD canonicaliser_api /home/ubuntu/canonicaliser_api
RUN virtualenv /home/ubuntu/canonicaliser_api/venv
RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && pip install -r /home/ubuntu/canonicaliser_api/requirements.txt
RUN export CFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/
RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && \
python /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/setup.py \
build_ext --inplace
The last line crashes with:
Traceback (most recent call last):
File "/home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/setup.py", line 5, in <module>
ext_modules = cythonize("*.pyx")
File "/home/ubuntu/canonicaliser_api/venv/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 754, in cythonize
aliases=aliases)
File "/home/ubuntu/canonicaliser_api/venv/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 649, in create_extension_list
for file in nonempty(extended_iglob(filepattern), "'%s' doesn't match any files" % filepattern):
File "/home/ubuntu/canonicaliser_api/venv/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 103, in nonempty
raise ValueError(error_msg)
ValueError: '*.pyx' doesn't match any files
...
What am I missing please?
I found the problem.
I had to downgrade to Cython 0.21 (This is main reason for the
error in question)
Afterwards I got another problem as the script didn't generate
anything, despite not throwing any errors. Solution to that was to be in that directory before executing it.
e.g.:
RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && cd /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/ && python setup.py build_ext --inplace
The painful part about Docker seems that you have to chain all commmands as it seems to be stateless.
Related
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install
RUN apt install python3.9 -y
RUN apt-get install -y git
RUN apt-get -y install python3-pip
RUN git clone https://ACCESS_TOKEN#github.com/username/repo
WORKDIR ./appy/
RUN pip install -r requirements.txt
CMD ["python3.9", "main.py"]
Hey, for some reason I'm getings
Traceback (most recent call last):
File "/appy/main.py", line 7, in <module>
import disnake
ModuleNotFoundError: No module named 'disnake'
requirements.txt
disnake=2.4.0
psutil=5.8.0
motor=2.5.1
aiohttp=3.7.4.post0
It appears that the packages in requirements.txt are not being installed properly. Any suggestions to what could be causing this? when building the container there doesn't seem to be any errors.And I can visually see when the container is built that all packages are installed. Including disnake.
I've tried installing Pyside2-uic using :
sudo apt-get install -y python-pyside2
sudo apt-get install pyside2-tools
while I'm converting the .ui file to .py using pyside2-uic still i get error as " ImportError: No module named pyside2uic.driver "
Traceback (most recent call last):
File "/usr/bin/pyside2-uic", line 28, in <module>
from pyside2uic.driver import Driver
ImportError: No module named pyside2uic.driver
How to resolve this error
I tried these commands and it worked.
$ apt-get install wget python-pip python-dev software-properties-common
$ add-apt-repository ppa:beineri/opt-qt561-trusty
$ apt-get update
$ apt-get install qt56-meta-full
$ . /opt/qt56/bin/qt56-env.sh
$ wget https://bintray.com/fredrikaverpil/pyside2-wheels/download_file?file_path=ubuntu14.04%2FPySide2-2.0.0.dev0-cp27-none-linux_x86_64.whl -O PySide2-2.0.0.dev0-cp27-none-linux_x86_64.whl
$ pip install PySide2-2.0.0.dev0-cp27-none-linux_x86_64.whl
$ pyside2-uic
I'm trying to build an image using DockerFile in AmazonSageMaker but I'm getting the following error.
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in
from pip import main ImportError: cannot import name 'main' The command '/bin/sh -c pip3 install --upgrade pip setuptools wheel &&
pip3 install mxnet-cu90 --upgrade --pre && pip3 install
keras-mxnet --upgrade --pre' returned a non-zero code: 1
My DockerFile is as below
FROM nvidia/cuda:9.0-runtime
RUN apt-get update && \
apt-get -y install build-essential libopencv-dev libopenblas-dev libjemalloc-dev libgfortran3 \
python-dev python3-dev python3-pip wget curl
COPY train_siamese_network.py /opt/program/train RUN chmod +x /opt/program/train
RUN mkdir /root/.keras COPY keras.json /root/.keras/
RUN pip3 install --upgrade pip setuptools wheel && \
pip3 install mxnet-cu90 --upgrade --pre && \
pip3 install keras-mxnet --upgrade --pre
RUN rm -rf /var/lib/apt/lists/* RUN rm -rf /root/.cache
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
ENV PATH="/opt/program:${PATH}"
WORKDIR /opt/program
you can run a container use image nvidia/cuda:9.0-runtime, try pip install command in the container and see what the command return
I try to use pjsua module for Python on Ubuntu 16.04.
When I try to call AccountConfig, it will return with following error message:
>>> import pjsua
>>> t=pjsua.AccountConfig()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pjsua.py", line 802, in __init__
self._cvt_from_pjsua(default)
File "pjsua.py", line 859, in _cvt_from_pjsua
for cred in cfg.cred_info:
MemoryError
Compiled pjsip with following:
sudo apt-get install build-essential python-dev libpjsua2
wget http://www.pjsip.org/release/2.7.2/pjproject-2.7.2.tar.bz2
sudo rm -fr pjproject-2.7.2
tar -xf pjproject-2.7.2.tar.bz2 && cd pjproject-2.7.2/
export CFLAGS="$CFLAGS -fPIC"
./configure --enable-shared --disable-sound && make dep && make
cd pjsip-apps/src/python/
sudo python setup.py install
I would appreciate any idea, what am I doing wrong.
Compile with following solved the issue:
sudo apt-get update
sudo apt-get -y install build-essential python-dev libpjsua2 libssl-dev libasound2-dev
wget http://www.pjsip.org/release/2.7.2/pjproject-2.7.2.tar.bz2
tar -xf pjproject-2.7.2.tar.bz2 && cd pjproject-2.7.2/
export CFLAGS="$CFLAGS -fPIC"
./configure && make dep && make
cd pjsip-apps/src/python/
sudo python setup.py install
I am new to Docker so I am sorry for such an easy question.
I am building a docker container which is built on top of a image which is built on ubuntu:vivid image.
When executing my script within the container I am getting an error:
exec: "python": executable file not found in $PATH
How can I solve this?
When I try to run apt-get install python in my Docker file:
FROM my_image # based on ubuntu:vivid
RUN apt-get update && \
apt-get install -y python3
ENV PATH /:$PATH
COPY file.py /
CMD ["python", "file.py", "-h"]
I get:
WARNING: The following packages cannot be authenticated!
libexpat1 libffi6 libmagic1 libmpdec2 libssl1.0.0 libpython3.4-minimal
mime-support libsqlite3-0 libpython3.4-stdlib python3.4-minimal
python3-minimal python3.4 libpython3-stdlib dh-python python3 file
E: There are problems and -y was used without --force-yes
The command '/bin/sh -c apt-get update && apt-get install -y python3' returned a non-zero code: 100
make: *** [image] Error 1
EDIT: added Dockerfile content
You have similar issue with some Linux distribution: "Why am I getting authentication errors for packages from an Ubuntu repository?"
In all cases, the usual sequence of command to install new packages is:
RUN apt-get update -yq && apt-get install -yqq \
git \
python \
...
The OP Ela reports in the comments:
RUN apt-get update -y && apt-get install -y --force-yes \
git \
python \
...
You are installing python3 and then you use the executable of python, I had the same issue and I have resolved using python3.
Try changing your last line of your Dockerfile :
instead of
CMD ["python", "file.py", "-h"]
try :
CMD ["python3", "file.py", "-h"]