pip cannot install websocket-server python packge - docker

I am inside my docker container, which is running centos6.6.1, and cannot seem to install the python package websocket-server.
pip install websocket-server
Could not find a version that satisfies the requirement websocket-server (from versions: )
I managed to get around this issue with the following command:
pip install git+http://github.com/Pithikos/python-websocket-server
but I don't like having to clone the repo in order to install the package. Any ideas how I can avoid this work around and get the first pip install to work?
I have the same problem with python package influxdb!

First what You need to do inside docker is upgrade pip and setuptools packages:
pip install -U setuptools pip
Do it inside virtualenv (if You use it).

Related

Error when installing python packages in dockerfile (qt5, pyqt5)

I am trying to install some packages into my docker environment so I can use them inside a container. But when I am running my Dockerfile I am getting the following error:
ERROR: Could not find a version that satisfies the requirement qt5 (from versions: none)
ERROR: No matching distribution found for qt5
Can someone please help me with this problem?
My Dockerfile:
FROM python:latest
WORKDIR /usr/src/app
RUN python3 -m pip install --upgrade pip
RUN pip3 install qt5
RUN pip3 install pyqt5
COPY ./server.py /app/
COPY ./hinto.py /app/
Note: I already have those packages successfully running on my host machine (Macbook m1)
From
https://pypi.org/project/PyQt5/
The GPL version of PyQt5 can be installed from PyPI:
Install it using:
pip3 install PyQt5

How to run jupyter notebook using docker with ubuntu?

I am very new to docker and could not figure out how to search google to answer my question.
I am using windows OS
I've created docker image using
FROM python:3
RUN apt-get update && apt-get install -y python3-pip
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip3 install jupyter
RUN useradd -ms /bin/bash demo
USER demo
WORKDIR /home/demo
ENTRYPOINT ["jupyter", "notebook", "--ip=0.0.0.0"]
and it worked fine. Now I've tried to create it again but with different libraries in requirements.txt it fails to build, it outputs ERROR: Could not find a version that satisfies requirement apturl==0.5.2. When I search what apturl is, I think we need ubuntu OS to install it.
So my question is how do you create a jupyter notebook server using docker with ubuntu libraries? (I am using Windows OS). Thanks!
try upgrading pip.
RUN pip install -U pip
RUN pip3 install -r requirements.txt

pipenv shell failed creating virtual environment

I am trying to create a virtual environment with the following command:
pipenv --three
But it doesn't work as the image shows:
What should I do?
I don't have virtual environment(s), like venv or virtualenv.
I had a similar problem and solved it in the following way
Uninstall PIP and pipenv, reinstall the version of python3. If not work, reinstall Python 3.7
sudo apt remove pip
sudo apt remove pipenv
sudo apt install python3-venv python3-pip
pip3 install pipenv
pipenv shell
Installing pip/setuptools/wheel with Linux Package Managers

Unable to deploy docker solution with conda-forge

I am deploying a docker solution for my application. In my docker file I used multiple conda-forge to build some containers. It worked very well for some of the containers, and give an error for the other and I am sure it is not about the package, because for the same package sometimes it work and others no.
I have tried to use pip instead of conda, but that lead to other errors since I am using conda originally for all of my configuration. Also, I read that RUN conda update --all will solve it, and for pip setup RUN pip install --upgrade setuptools
This is part of my docker file :
FROM dockerreg.cyanoptics.com/cyan/openjdk-java8:1.0.0
RUN conda update --all
RUN conda install -c conda-forge happybase=1.1.0 --yes
RUN conda install -c conda-forge requests-kerberos
RUN pip install --upgrade setuptools
RUN pip install --upgrade pip
RUN pip install kafka-python
RUN pip install requests-negotiate
The expected result is to build all containers successfully, but I am getting the following:
---> Using cache
---> 82f4cd49037d
Step 14 : RUN conda install -c conda-forge happybase=1.1.0 --yes
---> Using cache
---> c035b960aa3b
Step 15 : RUN conda install -c conda-forge requests-kerberos
---> Running in 54d869afcd00
Traceback (most recent call last):
File "/opt/conda/bin/conda", line 7, in <module>
from conda.cli import main
ModuleNotFoundError: No module named 'conda'
The command '/bin/sh -c conda install -c conda-forge requests-
kerberos' returned a non-zero code: 1
make: *** [dockerimage] Error 1
Try combining the two conda install commands into a single command: RUN conda install -c conda-forge happybase=1.1.0 requests-kerberos --yes.
I ran into a similar issue with the install commands split up; it turns out the issue was that the first caused the python version to be upgraded, which in turn was incompatible with the conda install command - causing the error you're seeing.
Another workaround I found was to add python 3.6.8 as another install arg. One of the packages I was installing must have had a python 3.7 dependency, forcing it to upgrade python, and breaking conda install.
Actually the error indicates the wrong path for conda /bin/sh
Therefore adding the proper path to the Dockerfile will solve the issue as following :
ENV PATH /opt/conda/envs/env/bin:$PATH
A good reference to related topic is here, where it suggests to create a new virtual environment within the dockerfile:
https://medium.com/#chadlagore/conda-environments-with-docker-82cdc9d25754

ImportError: No module named packaging.version

When I tried installing Flask I got this error:
ImportError: No module named packaging.version
To fix this, I had to do:
pip install setuptools
If your Python runs on Ubuntu, try to do this:
cd /usr/local/lib/python2.7/dist-packages
mv pkg_resources/ pkg_resources_bak/
I'm not sure what package installed the "pkg_resources", it will make pip always show error.
Try this
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
As an Ubuntu 14.04 user, upgrading pip to version 9.0.1 fixed this problem for me.
Upgrading pip normally
Download get-pip.py script
Run: python get-pip.py
Upgrading/installing pip behind a corporate firewall
Download get-pip.py script, along with pip, wheel, and setuptools from pypi
Place all files in the /tmp directory
Run the following command to install pip: sudo -H python /tmp/get-pip.py --no-index --find-links=/tmp pip
In case anyone stumbles upon this problem, my solution was to change the packaging version from 22.0 to 21.3.

Resources