lar3ry / OpenSCAD---Move-STL-to-origin

Makes a library tailored to an existing STL file. Move it to the origin in OpenSCAD.
7 stars 5 forks source link

Dockerfile fails to install marksafe #6

Open spuder opened 2 years ago

spuder commented 2 years ago

| OS: 11.6.1 (Big Sur) | Docker: 20.10.11

Thank you for providing a Dockerfile.

When attempting to run ./run-in-docker.sh Hook.stl The script produces the following error

ModuleNotFoundError: No module named 'markupsafe'
......
executor failed running [/bin/sh -c pip3 install --no-cache-dir stl numpy-stl]: exit code: 1

Related: https://github.com/rdickert/project-quicksilver/issues/6

Here is how others have fixed it:

Full Output

sudo ./run-in-docker.sh Hook.stl
[+] Building 68.2s (8/10)
 => [internal] load build definition from Dockerfile                                                                                                         0.0s
 => => transferring dockerfile: 247B                                                                                                                         0.0s
 => [internal] load .dockerignore                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                              0.0s
 => [internal] load metadata for docker.io/publysher/alpine-numpy:latest                                                                                     2.2s
 => [auth] publysher/alpine-numpy:pull token for registry-1.docker.io                                                                                        0.0s
 => [1/5] FROM docker.io/publysher/alpine-numpy@sha256:656cc3181b65482d2283a429eae65215841d32c72835ca1dbabed46a1c79669a                                     12.9s
 => => resolve docker.io/publysher/alpine-numpy@sha256:656cc3181b65482d2283a429eae65215841d32c72835ca1dbabed46a1c79669a                                      0.0s
 => => sha256:656cc3181b65482d2283a429eae65215841d32c72835ca1dbabed46a1c79669a 1.58kB / 1.58kB                                                               0.0s
 => => sha256:bd60ccc63866db4295c55ce971d2ab00444c1da6266287df5302a8102f26e062 6.50kB / 6.50kB                                                               0.0s
 => => sha256:ff3a5c916c92643ff77519ffa742d3ec61b7f591b6b7504599d95a4a41134e28 2.07MB / 2.07MB                                                               2.2s
 => => sha256:471170bb1257626389ed5fd16962cdec310ab3af264ffef445df2773e7420b92 308.01kB / 308.01kB                                                           0.5s
 => => sha256:a92899abaf426b4fc95700ecc8dee0153d4a7374e7c5fa6586fcc2e2b326db41 27.74MB / 27.74MB                                                             7.7s
 => => sha256:2699438859de183d00dd84d486f6b57bbbc172bf905399e814c500e6c50d04c7 227B / 227B                                                                   0.8s
 => => sha256:d278818cf042d33ced356d1a90b8e7b6ab2f9d020ae1c35c0db5385c9b0d9489 1.90MB / 1.90MB                                                               2.5s
 => => extracting sha256:ff3a5c916c92643ff77519ffa742d3ec61b7f591b6b7504599d95a4a41134e28                                                                    2.2s
 => => sha256:d1f6bd65a64f799b29a9300314dbf85ae59b31bf90ef8917fbf275683d48bc5f 16.21MB / 16.21MB                                                            11.2s
 => => extracting sha256:471170bb1257626389ed5fd16962cdec310ab3af264ffef445df2773e7420b92                                                                    0.2s
 => => extracting sha256:a92899abaf426b4fc95700ecc8dee0153d4a7374e7c5fa6586fcc2e2b326db41                                                                    2.5s
 => => extracting sha256:2699438859de183d00dd84d486f6b57bbbc172bf905399e814c500e6c50d04c7                                                                    0.0s
 => => extracting sha256:d278818cf042d33ced356d1a90b8e7b6ab2f9d020ae1c35c0db5385c9b0d9489                                                                    0.6s
 => => extracting sha256:d1f6bd65a64f799b29a9300314dbf85ae59b31bf90ef8917fbf275683d48bc5f                                                                    1.4s
 => [internal] load build context                                                                                                                            0.1s
 => => transferring context: 1.18MB                                                                                                                          0.1s
 => [2/5] WORKDIR /usr/src/app                                                                                                                               0.7s
 => ERROR [3/5] RUN pip3 install --no-cache-dir stl numpy-stl                                                                                               52.1s
------
 > [3/5] RUN pip3 install --no-cache-dir stl numpy-stl:
#7 0.851 Collecting stl
#7 1.316   Downloading https://files.pythonhosted.org/packages/aa/91/4bdb12160348109179158d34e6eda6279166302ec0224d6edc8324f344df/stl-0.0.3.tar.gz
#7 51.46     Complete output from command python setup.py egg_info:
#7 51.46     Traceback (most recent call last):
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
#7 51.46         yield saved
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
#7 51.46         yield
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
#7 51.46         _execfile(setup_script, ns)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
#7 51.46         exec(code, globals, locals)
#7 51.46       File "/tmp/easy_install-wvpyjoi3/MarkupSafe-2.0.1/setup.py", line 61, in <module>
#7 51.46       File "/tmp/easy_install-wvpyjoi3/MarkupSafe-2.0.1/setup.py", line 44, in run_setup
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
#7 51.46         return distutils.core.setup(**attrs)
#7 51.46       File "/usr/local/lib/python3.6/distutils/core.py", line 121, in setup
#7 51.46         dist.parse_config_files()
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 494, in parse_config_files
#7 51.46         ignore_option_errors=ignore_option_errors)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 106, in parse_configuration
#7 51.46         meta.parse()
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 382, in parse
#7 51.46         section_parser_method(section_options)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 355, in parse_section
#7 51.46         self[name] = value
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 173, in __setitem__
#7 51.46         value = parser(value)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 430, in _parse_version
#7 51.46         version = self._parse_attr(value)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 305, in _parse_attr
#7 51.46         module = import_module(module_name)
#7 51.46       File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
#7 51.46         return _bootstrap._gcd_import(name[level:], package, level)
#7 51.46       File "<frozen importlib._bootstrap>", line 994, in _gcd_import
#7 51.46       File "<frozen importlib._bootstrap>", line 971, in _find_and_load
#7 51.46       File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
#7 51.46     ModuleNotFoundError: No module named 'markupsafe'
#7 51.46
#7 51.46     During handling of the above exception, another exception occurred:
#7 51.46
#7 51.46     Traceback (most recent call last):
#7 51.46       File "<string>", line 1, in <module>
#7 51.46       File "/tmp/pip-install-ldpg2ms9/stl/setup.py", line 31, in <module>
#7 51.46         "Intended Audience :: Developers",
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 128, in setup
#7 51.46         _install_setup_requires(attrs)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
#7 51.46         dist.fetch_build_eggs(dist.setup_requires)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 513, in fetch_build_eggs
#7 51.46         replace_conflicting=True,
#7 51.46       File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
#7 51.46         replace_conflicting=replace_conflicting
#7 51.46       File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1057, in best_match
#7 51.46         return self.obtain(req, installer)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1069, in obtain
#7 51.46         return installer(requirement)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 580, in fetch_build_egg
#7 51.46         return cmd.easy_install(req)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
#7 51.46         return self.install_item(spec, dist.location, tmpdir, deps)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 699, in install_item
#7 51.46         dists = self.install_eggs(spec, download, tmpdir)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 884, in install_eggs
#7 51.46         return self.build_and_install(setup_script, setup_base)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1152, in build_and_install
#7 51.46         self.run_setup(setup_script, setup_base, args)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1138, in run_setup
#7 51.46         run_setup(setup_script, args)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 253, in run_setup
#7 51.46         raise
#7 51.46       File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
#7 51.46         self.gen.throw(type, value, traceback)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
#7 51.46         yield
#7 51.46       File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
#7 51.46         self.gen.throw(type, value, traceback)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 166, in save_modules
#7 51.46         saved_exc.resume()
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 141, in resume
#7 51.46         six.reraise(type, exc, self._tb)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 685, in reraise
#7 51.46         raise value.with_traceback(tb)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
#7 51.46         yield saved
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
#7 51.46         yield
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
#7 51.46         _execfile(setup_script, ns)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
#7 51.46         exec(code, globals, locals)
#7 51.46       File "/tmp/easy_install-wvpyjoi3/MarkupSafe-2.0.1/setup.py", line 61, in <module>
#7 51.46       File "/tmp/easy_install-wvpyjoi3/MarkupSafe-2.0.1/setup.py", line 44, in run_setup
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
#7 51.46         return distutils.core.setup(**attrs)
#7 51.46       File "/usr/local/lib/python3.6/distutils/core.py", line 121, in setup
#7 51.46         dist.parse_config_files()
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 494, in parse_config_files
#7 51.46         ignore_option_errors=ignore_option_errors)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 106, in parse_configuration
#7 51.46         meta.parse()
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 382, in parse
#7 51.46         section_parser_method(section_options)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 355, in parse_section
#7 51.46         self[name] = value
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 173, in __setitem__
#7 51.46         value = parser(value)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 430, in _parse_version
#7 51.46         version = self._parse_attr(value)
#7 51.46       File "/usr/local/lib/python3.6/site-packages/setuptools/config.py", line 305, in _parse_attr
#7 51.46         module = import_module(module_name)
#7 51.46       File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
#7 51.46         return _bootstrap._gcd_import(name[level:], package, level)
#7 51.46       File "<frozen importlib._bootstrap>", line 994, in _gcd_import
#7 51.46       File "<frozen importlib._bootstrap>", line 971, in _find_and_load
#7 51.46       File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
#7 51.46     ModuleNotFoundError: No module named 'markupsafe'
#7 51.46
#7 51.46     ----------------------------------------
#7 51.66 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-ldpg2ms9/stl/
#7 51.92 You are using pip version 10.0.1, however version 21.3.1 is available.
#7 51.92 You should consider upgrading via the 'pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip3 install --no-cache-dir stl numpy-stl]: exit code: 1
spuder commented 2 years ago

This appears to be a common problem others have reported in other projects. I've tried the following solutions in my local Dockerfile with no luck so far

RUN easy_install markupsafe
RUN pip3 install --no-cache-dir stl numpy-stl

RUN pip install markupsafe
RUN pip3 install --no-cache-dir stl numpy-stl

RUN pip install markupsafe
RUN pip3 install --no-cache-dir stl numpy-stl

RUN apt reinstall python-markupsafe
RUN pip3 install --no-cache-dir stl numpy-stl
spuder commented 2 years ago

publysher/alpine-numpy hasn't been updated in 4 years. By changing the from line from publysher/alpine-numpy to python:3.6-alpine3.7 then adding the apk add && pip install numpy commands taken from the referenced dockerfile I was able to get this working. However it looses all the benefits of having a prebuilt dockerfile so it takes a very long time to build

Temporary solution:

# FROM publysher/alpine-numpy
FROM python:3.6-alpine3.7
WORKDIR /usr/src/app

RUN apk --no-cache add --virtual .builddeps gcc gfortran musl-dev     && pip install numpy==1.14.0     && apk del .builddeps     && rm -rf /root/.cache

RUN pip install -U MarkupSafe
RUN pip3 install --no-cache-dir stl numpy-stl

COPY stldim.py .
COPY .passed_file.stl .

ENTRYPOINT ["python", "./stldim.py" ]
CMD [ ".passed_file.stl" ]

A better long term solution would be to have a github action or manual build process that builds this once, then stores on dockerhub. That way users just need to do docker pull and they will quickly get a repeatable container.

https://docs.github.com/en/actions/publishing-packages/publishing-docker-images