Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'versioneer' #502

Open
C-Loftus opened this issue Dec 3, 2024 · 3 comments
Open

ModuleNotFoundError: No module named 'versioneer' #502

C-Loftus opened this issue Dec 3, 2024 · 3 comments

Comments

@C-Loftus
Copy link

C-Loftus commented Dec 3, 2024

I am trying to install pyogrio inside of Docker with Python 3.9 but I am getting an error that versioneer is not installed. I have tried pip install versioneer and it did not help. I have tried upgrading pip and messing around with a variety of permutations of the install process but it did not help. I wasn't clear what is wrong since I appear to have a supported Python version.

This is an abbreviated version of my dockerfile with only the relevant installs

FROM python:3.9.13-slim

ENV TZ="Etc/UTC" \
    DEBIAN_FRONTEND="noninteractive" \
    DEBIAN_PACKAGES="cron bash vim git libffi-dev libeccodes0 python3-eccodes python3-cryptography libssl-dev libudunits2-0 python3-paho-mqtt python3-dateparser python3-tz python3-setuptools"

RUN apt-get update -y \
    && apt-get install -y -t bookworm libeccodes-data \
    && apt-get install -y ${DEBIAN_PACKAGES} \
    # install shapely
    && pip3 install cython pygeos==0.13 \
    && pip3 install -U "shapely<2" --no-binary shapely \
    # cleanup
    && apt autoremove -y  \
    && apt-get -q clean \
    && rm -rf /var/lib/apt/lists/*

# copy the app
COPY . /app
RUN pip install --upgrade pip

RUN cd /app \
    && python3 setup.py install \
    && $PIP_PLUGIN_PACKAGES \

COPY ./docker/entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]

requirements.txt

isodate
httpx
minio
OWSLib
paho-mqtt<2
pygeometa
PyYAML
requests
pytest
debugpy
pandas
frost-sta-client

versioneer
pyogrio

error trace

0.251 Searching for pyogrio
0.251 Reading https://pypi.org/simple/pyogrio/
0.428 Downloading https://files.pythonhosted.org/packages/a5/8f/5a784595524a79c269f2b1c880f4fdb152867df700c97005dda51997da02/pyogrio-0.10.0.tar.gz#sha256=ec051cb568324de878828fae96379b71858933413e185148acb6c162851ab23c
0.541 Best match: pyogrio 0.10.0
0.541 Processing pyogrio-0.10.0.tar.gz
0.556 Writing /tmp/easy_install-hadli4yz/pyogrio-0.10.0/setup.cfg
0.556 Running pyogrio-0.10.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-hadli4yz/pyogrio-0.10.0/egg-dist-tmp-b4vg5yw8
0.582 Traceback (most recent call last):
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 156, in save_modules
0.582     yield saved
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 198, in setup_context
0.582     yield
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 259, in run_setup
0.582     _execfile(setup_script, ns)
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 46, in _execfile
0.582     exec(code, globals, locals)
0.582   File "/tmp/easy_install-hadli4yz/pyogrio-0.10.0/setup.py", line 10, in <module>
0.582     #
0.582 ModuleNotFoundError: No module named 'versioneer'
0.582 
0.582 During handling of the above exception, another exception occurred:
0.582 
0.582 Traceback (most recent call last):
0.582   File "/app/setup.py", line 78, in <module>
0.582     setup(
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
0.582     return distutils.core.setup(**attrs)
0.582   File "/usr/local/lib/python3.9/distutils/core.py", line 148, in setup
0.582     dist.run_commands()
0.582   File "/usr/local/lib/python3.9/distutils/dist.py", line 966, in run_commands
0.582     self.run_command(cmd)
0.582   File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
0.582     cmd_obj.run()
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 67, in run
0.582     self.do_egg_install()
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 117, in do_egg_install
0.582     cmd.run(show_deprecation=False)
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 408, in run
0.582     self.easy_install(spec, not self.no_deps)
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 650, in easy_install
0.582     return self.install_item(None, spec, tmpdir, deps, True)
0.582   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 697, in install_item
0.583     self.process_distribution(spec, dist, deps)
0.583   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 744, in process_distribution
0.583     distros = WorkingSet([]).resolve(
0.583   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 766, in resolve
0.583     dist = best[req.key] = env.best_match(
0.583   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1051, in best_match
0.583     return self.obtain(req, installer)
0.583   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1063, in obtain
0.583     return installer(requirement)
0.583   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 669, in easy_install
0.583     return self.install_item(spec, dist.location, tmpdir, deps)
0.583   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 695, in install_item
0.583     dists = self.install_eggs(spec, download, tmpdir)
0.583   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
0.583     return self.build_and_install(setup_script, setup_base)
0.583   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 1162, in build_and_install
0.583     self.run_setup(setup_script, setup_base, args)
0.583   File "/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 1146, in run_setup
0.583     run_setup(setup_script, args)
0.583   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 262, in run_setup
0.584     raise
0.584   File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
0.584     self.gen.throw(typ, value, traceback)
0.584   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 198, in setup_context
0.584     yield
0.584   File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
0.584     self.gen.throw(typ, value, traceback)
0.584   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 169, in save_modules
0.584     saved_exc.resume()
0.584   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 143, in resume
0.584     raise exc.with_traceback(self._tb)
0.584   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 156, in save_modules
0.584     yield saved
0.584   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 198, in setup_context
0.584     yield
0.584   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 259, in run_setup
0.584     _execfile(setup_script, ns)
0.584   File "/usr/local/lib/python3.9/site-packages/setuptools/sandbox.py", line 46, in _execfile
0.584     exec(code, globals, locals)
0.584   File "/tmp/easy_install-hadli4yz/pyogrio-0.10.0/setup.py", line 10, in <module>
0.584     #
0.584 ModuleNotFoundError: No module named 'versioneer'
@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Dec 3, 2024

Could you try to use pip install . instead of python3 setup.py install ?

EDIT: Ah, but the python3 setup.py install is for your "app", that's not installing pyogrio?

How/where is pyogrio getting installed in the above dockerfile?

@C-Loftus
Copy link
Author

C-Loftus commented Dec 3, 2024

I am installing requirements.txt from within setup.py (i.e. install_requires=read('requirements.txt').splitlines(), )
since I am working on developing a library inside the container. Sorry I should have clarified that.

So to my understanding it is just a standard pip install using the requirements.txt above. I do not have any versions pinned.

@jorisvandenbossche
Copy link
Member

So to my understanding it is just a standard pip install using the requirements.txt above. I do not have any versions pinned.

I suppose that is not actually the case (not entirely sure though, just a quick guess). Because you are installing the package using setuptools (python3 setup.py install), and so setuptools is then handling that install_requires, and at that point I assume it is also setuptools that will handle those installs, guessing that setuptools does not know about pip.

If you would install the package with pip, at that point is is pip that takes care of installing the dependencies.

If you don't want or can't change the installation invocation, I would maybe ensure to install the requirements with pip explicitly up front.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants