# Last step in Dockerfile failing

**URL:** <https://renku.discourse.group/t/last-step-in-dockerfile-failing/462>\
**Category:** RenkuLab\
**Created:** [27 October 2021 15:48 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462 "2021-10-27T15:48:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![firat](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@firat](https://renku.discourse.group/u/firat)\
**Post date:** [27 October 2021 15:48 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/1 "2021-10-27T15:48:36Z")

</div>

Upon pushing to [renkulab.io](http://renkulab.io), the last step of building docker image fails, complaining about pipx not found: [link to ci/cd job](https://renkulab.io/gitlab/deepcloud/regress-radiation/-/jobs/304619)

To be more precise the following line

```auto
RUN if [-n "$RENKU_VERSION"] ; then \

        currentversion=$(pipx list | sed -n "s/^\s*package\srenku\s\([^,]\+\),.*$/\1/p") ; \

        if ["$RENKU_VERSION" != "$currentversion"] ; then \

            pipx uninstall renku ; \

            gitversion=$(echo "$RENKU_VERSION" | sed -n "s/^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\(\.dev[[:digit:]]\+\)*\(+g\([a-f0-9]\+\)\)*\(+dirty\)*$/\3/p"); \

            if [-n "$gitversion"] ; then \

                pipx install --force "git+https://github.com/SwissDataScienceCenter/renku-python.git@$gitversion" ;\

            else \

                pipx install --force renku==${RENKU_VERSION} ;\

            fi \

        fi \

    fi

```

is causing error

```auto
Traceback (most recent call last):
  File "/opt/conda/bin/pipx", line 5, in <module>
    from pipx.main import cli
ModuleNotFoundError: No module named 'pipx'
Traceback (most recent call last):
  File "/opt/conda/bin/pipx", line 5, in <module>
    from pipx.main import cli
ModuleNotFoundError: No module named 'pipx'
Traceback (most recent call last):
  File "/opt/conda/bin/pipx", line 5, in <module>
    from pipx.main import cli
ModuleNotFoundError: No module named 'pipx'

```

on [renkulab.io](http://renkulab.io) CI/CD jobs. Could I be doing something to cause this issue?

---

<div class="post-metadata">

**Author:** ![andreas](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/andreas/32/8_2.png) [@andreas](https://renku.discourse.group/u/andreas)\
**Post date:** [27 October 2021 16:04 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/2 "2021-10-27T16:04:46Z")

</div>

hi @firat,  
what base image are you using for this project? We’ve recently changed the way we install the renku-cli into our base image. See [this commit](https://github.com/SwissDataScienceCenter/renku-project-template/commit/2c82f6019e092c9f36213d0df3a6f192b3c3be8b) and [this](https://github.com/SwissDataScienceCenter/renkulab-docker/commit/ba6ccccc3b8db039f8f914f61d4fb42984c58d6b). Therefore, newer images do not have pipx installed anymore.

In this case, replacing the bottom section of your projects Dockerfile with

```auto
########################################################
# Do not edit this section and do not add anything below

# Install renku from pypi or from github if it's a dev version
RUN if [-n "$RENKU_VERSION"] ; then \
        source .renku/venv/bin/activate ; \
        currentversion=$(renku --version) ; \
        if ["$RENKU_VERSION" != "$currentversion"] ; then \
            pip uninstall renku -y ; \
            gitversion=$(echo "$RENKU_VERSION" | sed -n "s/^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\(\.dev[[:digit:]]\+\)*\(+g\([a-f0-9]\+\)\)*\(+dirty\)*$/\3/p") ; \
            if [-n "$gitversion"] ; then \
                pip install --force "git+https://github.com/SwissDataScienceCenter/renku-python.git@$gitversion" ;\
            else \
                pip install --force renku==${RENKU_VERSION} ;\
            fi \
        fi \
    fi

########################################################

```

should do it.

---

<div class="post-metadata">

**Author:** ![firat](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@firat](https://renku.discourse.group/u/firat)\
**Post date:** [28 October 2021 06:53 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/3 "2021-10-28T06:53:51Z")

</div>

Hi @andreas,  
I’m using `RENKU_BASE_IMAGE=renku/renkulab-py:3.8-0.8.0`, I want to stick with python 3.8 mainly due to the workstation I’m running the project on supporting that at most.  
The project is still using `RENKU_VERSION=0.16.0`, shouldn’t the recent changes not affect this project?  
I regardless tried the new block you suggested, but it fails [failing-job](https://renkulab.io/gitlab/deepcloud/regress-radiation/-/jobs/304879) since there is no virtual env `venv`. I’m a bit confused about that one though, I’m not trying to containerize my project, I’m only referring to the default CI/CD that runs on [renkulab.io](http://renkulab.io) when I push changes to the remote.

---

<div class="post-metadata">

**Author:** ![firat](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@firat](https://renku.discourse.group/u/firat)\
**Post date:** [28 October 2021 13:38 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/4 "2021-10-28T13:38:19Z")

</div>

A quick update, removing

```auto
  - python==3.8
  - tensorflow==2.4

```

from environment.yml fixes it, but I think it only fixes it because then CI/CD just uses cache.

---

<div class="post-metadata">

**Author:** ![andreas](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/andreas/32/8_2.png) [@andreas](https://renku.discourse.group/u/andreas)\
**Post date:** [28 October 2021 13:42 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/5 "2021-10-28T13:42:44Z")

</div>

Ah ok. Your base image still contains pipx and the renku cli installed through pipx, so adding the snippet which I’ve pasted above doesn’t make sense at all.

Does building the image locally work?

---

<div class="post-metadata">

**Author:** ![andreas](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/andreas/32/8_2.png) [@andreas](https://renku.discourse.group/u/andreas)\
**Post date:** [28 October 2021 13:44 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/6 "2021-10-28T13:44:59Z")

</div>

When trying locally, make sure to pull the base image (we don’t retag those, but just to be sure) and use the `--no-cache` option.

---

<div class="post-metadata">

**Author:** ![firat](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@firat](https://renku.discourse.group/u/firat)\
**Post date:** [28 October 2021 13:45 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/7 "2021-10-28T13:45:33Z")

</div>

I am not sure how to build the image locally. Also, the workstation does not have docker. I can clone the repo to my laptop and try that maybe next week sometime… thanks!

---

<div class="post-metadata">

**Author:** ![andreas](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/andreas/32/8_2.png) [@andreas](https://renku.discourse.group/u/andreas)\
**Post date:** [28 October 2021 13:47 UTC](https://renku.discourse.group/t/last-step-in-dockerfile-failing/462/8 "2021-10-28T13:47:59Z")

</div>

> I can clone the repo to my laptop and try that maybe next week sometime

Yeah, I’d strongly recommend that. Debugging build pipelines is usually much quicker when you can build images locally than through CI jobs.
