knowledge-repo icon indicating copy to clipboard operation
knowledge-repo copied to clipboard

Unable to install knowledge-repo inside a container

Open drorata opened this issue 8 years ago • 5 comments

Auto-reviewers: @NiharikaRay @matthewwardrop @earthmancash @danfrankj

I am trying to install knowledge-repo inside a container. To that end, I started a new container:

docker run -i -t --name knowledge-repo continuumio/miniconda3 /bin/bash

Next, I tried to install the tool: pip install --upgrade knowledge-repo[all]. This ended with the following error:

Traceback (most recent call last):
  File "/opt/conda/bin/pip", line 6, in <module>
    sys.exit(pip.main())
  File "/opt/conda/lib/python3.6/site-packages/pip/__init__.py", line 249, in main
    return command.main(cmd_args)
  File "/opt/conda/lib/python3.6/site-packages/pip/basecommand.py", line 252, in main
    pip_version_check(session)
  File "/opt/conda/lib/python3.6/site-packages/pip/utils/outdated.py", line 102, in pip_version_check
    installed_version = get_installed_version("pip")
  File "/opt/conda/lib/python3.6/site-packages/pip/utils/__init__.py", line 838, in get_installed_version
    working_set = pkg_resources.WorkingSet()
  File "/opt/conda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 644, in __init__
    self.add_entry(entry)
  File "/opt/conda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 700, in add_entry
    for dist in find_distributions(entry, True):
  File "/opt/conda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1949, in find_eggs_in_zip
    if metadata.has_metadata('PKG-INFO'):
  File "/opt/conda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1463, in has_metadata
    return self.egg_info and self._has(self._fn(self.egg_info, name))
  File "/opt/conda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
    return zip_path in self.zipinfo or zip_path in self._index()
  File "/opt/conda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
    return self._zip_manifests.load(self.loader.archive)
  File "/opt/conda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
    mtime = os.stat(path).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/opt/conda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg'

I am not even sure the problem is within the scope of this repository. I'll be happy to provide more details.

drorata avatar Apr 07 '17 13:04 drorata

Hi @drorata,

Thanks for reaching out and for your interest in the knowledge repository!

We internally install knowledge-repo into a docker container (without using anaconda), and our Travis CI tests do the same thing (with anaconda) and I know others have had some success too... so I don't think this is a generic issue.

If I had to take a stab, I'd say the issues you're experiencing above are related to an anaconda bug, not a knowledge_repo one; since your pip install command cannot find setuptools. You can see how we use miniconda successfully in our .travis.yml folder in the git repository. If you find that you do need help, I can perhaps review this more closely.

matthewwardrop avatar Apr 11 '17 20:04 matthewwardrop

This still doesn't really work for me. I tried to start with a cleaner image, namely ubuntu. Here are the steps I took:

docker run -it --name knowledge-repo ubuntu /bin/bash # on local machine
apt-get update # on container
apt-get install wget
apt-get install bzip2
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p ./miniconda
miniconda/bin/conda install pip
miniconda/bin/pip install --upgrade knowledge-repo[all]

This ended again with the following error:

Traceback (most recent call last):
  File "miniconda/bin/pip", line 6, in <module>
    sys.exit(pip.main())
  File "/miniconda/lib/python3.6/site-packages/pip/__init__.py", line 249, in main
    return command.main(cmd_args)
  File "/miniconda/lib/python3.6/site-packages/pip/basecommand.py", line 252, in main
    pip_version_check(session)
  File "/miniconda/lib/python3.6/site-packages/pip/utils/outdated.py", line 102, in pip_version_check
    installed_version = get_installed_version("pip")
  File "/miniconda/lib/python3.6/site-packages/pip/utils/__init__.py", line 838, in get_installed_version
    working_set = pkg_resources.WorkingSet()
  File "/miniconda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 644, in __init__
    self.add_entry(entry)
  File "/miniconda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 700, in add_entry
    for dist in find_distributions(entry, True):
  File "/miniconda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1949, in find_eggs_in_zip
    if metadata.has_metadata('PKG-INFO'):
  File "/miniconda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1463, in has_metadata
    return self.egg_info and self._has(self._fn(self.egg_info, name))
  File "/miniconda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
    return zip_path in self.zipinfo or zip_path in self._index()
  File "/miniconda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
    return self._zip_manifests.load(self.loader.archive)
  File "/miniconda/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
    mtime = os.stat(path).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/miniconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg'

drorata avatar Apr 14 '17 18:04 drorata

Hi,

I think it requires some missing packages, try with these ones (using python 3) :

# Install dependencies 
RUN apt-get update && apt-get install -y \
	build-essential \
	git \
	python3-dev \
	python3-pip \
	python3-psycopg2

said026 avatar Jun 09 '17 09:06 said026

@drorata have you resolved this problem? Can you, please, post a working Dockerfile. I'll have to dockerize this app in order to run it in K8s. An existing container would help a lot.

pavelnikolov avatar Apr 04 '18 02:04 pavelnikolov

To be honest I didn't follow up on this. But now I tried out the following Dockerfile:

FROM ubuntu:16.04

RUN apt-get update # on container
RUN apt-get install -y wget bzip2
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
RUN bash miniconda.sh -b -p ./miniconda
RUN miniconda/bin/conda install pip
RUN miniconda/bin/pip install --upgrade knowledge-repo[all]

And it seems to build the image correctly. I didn't check, however, whether knowledge-repo actually works when running the image.

I hope this is helpful. Cheers, Dror

drorata avatar Apr 09 '18 08:04 drorata