amundsen icon indicating copy to clipboard operation
amundsen copied to clipboard

Bug Report error in Dockerfile.frontend.local file build

Open foryou7242 opened this issue 3 years ago • 18 comments

Expected Behavior

i playing this command docker-compose -f docker-amundsen-local.yml up i want make image using local dockerfile in my host

Current Behavior

i got error

#22 1.984 Obtaining file:///app
#22 4.968     ERROR: Command errored out with exit status 1:
#22 4.968      command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/app/setup.py'"'"'; __file__='"'"'/app/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exi
sts(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info
-cdo5u_mq
#22 4.968          cwd: /app/
#22 4.968     Complete output (10 lines):
#22 4.968     /bin/sh: 1: npm: not found
#22 4.968     ERROR:root:npm must be available
#22 4.968     /bin/sh: 1: npm: not found
#22 4.968     /app/setup.py:30: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
#22 4.968       logging.warn('Installation of npm dependencies failed')
#22 4.968     WARNING:root:Installation of npm dependencies failed
#22 4.968     /app/setup.py:31: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
#22 4.968       logging.warn(str(e))
#22 4.968     WARNING:root:Command '['npm install']' returned non-zero exit status 127.
#22 4.968     error in amundsen-frontend setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
#22 4.968     ----------------------------------------
#22 4.968 WARNING: Discarding file:///app. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#22 4.968 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
------
executor failed running [/bin/sh -c pip3 install -e .]: exit code: 1
ERROR: Service 'amundsenfrontend' failed to build : Build failed

Possible Solution

Steps to Reproduce

  1. git clone https://github.com/amundsen-io/amundsen.git
  2. git checkout -t main 3.docker-compose -f docker-amundsen-local.yml up

Screenshots (if appropriate)

image

Context

Your Environment

  • Amunsen version used:
  • Data warehouse stores:
  • Deployment (k8s or native):
  • Link to your fork or repository:

foryou7242 avatar Jul 07 '21 07:07 foryou7242

Thanks for opening your first issue here!

boring-cyborg[bot] avatar Jul 07 '21 07:07 boring-cyborg[bot]

i think Dockerfile.frontend.local base images "python:3.7-slim" and in frontend/setup.py source

def build_js() -> None:
    if not is_npm_installed():
        logging.error('npm must be available')
    try:
        subprocess.check_call(['npm install'], cwd=PACKAGE_DIR, shell=True)
        subprocess.check_call(['npm run build'], cwd=PACKAGE_DIR, shell=True)

call npm install python:3.7-slim images has not npm (edited)

foryou7242 avatar Jul 07 '21 07:07 foryou7242

Have you tried any of the solutions listed here https://github.com/giampaolo/psutil/issues/1268 or here https://stackoverflow.com/questions/63687990/extras-require-must-be-a-dictionary-whose-values-are-strings-or-lists-of-strin?

danlfels avatar Jul 12 '21 13:07 danlfels

@danlfels thank you for my issue

this error is npm : not found

frontend/setup.py

call build_js()

build js function are called "npm" command but npm binary was not install

setup.py was not check requirements file

foryou7242 avatar Jul 13 '21 00:07 foryou7242

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Jul 29 '21 07:07 stale[bot]

Faced the same issue. Didn't figure out the solution. Any requests?

PolinaKriv avatar Aug 04 '21 08:08 PolinaKriv

I ran into this as well when I was trying to run the quickstart...

I know the issue has to do with the windows OS, I tested this with some colleagues who were running Macs and they didnt get the error. This was repeated on 3 Macs and 2 windows machines.

I have no clue how to fix it though.

colter-nattrass avatar Aug 09 '21 15:08 colter-nattrass

Have you tried reinstaliing git on windows with symlinks enabled? image

mgorsk1 avatar Aug 09 '21 15:08 mgorsk1

Have you tried reinstaliing git on windows with symlinks enabled?

I will try this now! Thanks

colter-nattrass avatar Aug 09 '21 15:08 colter-nattrass

Alternatively, depending on what you want to achieve, you could try running ubuntu docker container on windows and git clone amundsen code inside the container. Just mount some volume externally so the artifacts are available on windows and build amundsen from within ubuntu container so symlinks and everything else works.

mgorsk1 avatar Aug 09 '21 15:08 mgorsk1

Yeah the symbolic links fix didnt work... Im going to see if I can get it to build it in WSL2

colter-nattrass avatar Aug 09 '21 20:08 colter-nattrass

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Aug 23 '21 23:08 stale[bot]

Still have the same error: image

Run on Windows machine.

miltad avatar Sep 06 '21 11:09 miltad

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Sep 20 '21 13:09 stale[bot]

I am also having the issue.

image

pyguy2gmailcom avatar Oct 08 '21 21:10 pyguy2gmailcom

I changed "FROM python:3.7-slim" to "FROM nikolaik/python-nodejs:python3.7-nodejs12-slim" and the build process goes on but I get in another error and I can't find any reason image

fforever14 avatar Oct 29 '21 02:10 fforever14

Thanks @fforever14, my problem with npm is resolved. Like you, I still have an error with: "error in amundsen-frontend setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers."

image

matwalk avatar Jan 15 '22 23:01 matwalk

A lot of moving targets here, but I'll show you a few situations were this fails:

  1. Run wsl, point to a windows mnt containing the amundsen source code
  2. Try to build a linux container from Windows

And what will work:

  1. run wsl and checkout the code to a folder in your unix filesystem

Demo of why 1 & 2 fails:

Remove RUN pip3 install -e . from the file Dockerfile.frontend.local then build it and run it:

docker build -f Dockerfile.frontend.local . --tag bug
docker run -it --entrypoint /bin/bash bug:latest

Then from inside the container, take a look at the requirements-dev file:

 > cat requirements-dev.txt
../requirements-dev.txtroot@0361996aac5a:

The file is garbled, I think it has to do with the symlinks (the common requirements files are symlinked into the frontend folder).

If you checkout a clean repo inside the wsl dist, the requirements files are not garbage, and you will not get the

amundsen-frontend setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers

This is the actual error, the "npm not installed" is a red herring, because if you look at the aforementioned dockerfile, you have already built the js dist, so no need to do that all over again in setup.py

mariusingjer avatar Feb 23 '22 12:02 mariusingjer

I was having the same issue an after many attempts I've found this steps works for me

  • In the Dockerfile.frontend.local file:

    1. Replace ~~FROM node:12-slim as node-stage~~ with FROM node:12-alpine as node-stage
    2. Remove the istruction FROM python:3.7-slim
    3. Add the install of python right after the line COPY ./frontend /app with the following directives: ENV PYTHONUNBUFFERED=1 RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python RUN python3 -m ensurepip RUN pip3 install --no-cache --upgrade pip setuptools
    4. Remove the istruction COPY --from=node-stage /app /app
  • In docker-amundsen-local.yml:

    1. Change the ports of amundsearch service 5001:~~5001~~ with 5001:5000
    2. Change the ports of amundsenmetadata service 5002:~~5002~~ with 5002:5000

It can be improved for sure and I'm going to test other configurations in the meantime but for now it seems to work (i'm trying to follow a guide to make lineage visible and finally I can see it)

silverik avatar Nov 04 '22 10:11 silverik

@silverik i did what you have mentioned, but facing same issue as you can see below

PS C:\Users\MG> docker-compose -f docker-amundsen-local.yml up [+] Building 0.1s (3/4) => [mg_amundsenfrontend internal] load build definition from Dockerfile.frontend.local 0.1s => => transferring dockerfile: 2B 0.0s => CANCELED [mg_amundsensearch internal] load build definition from Dockerfile.search.public 0.0s => => transferring dockerfile: 0.1s => CANCELED [mg_amundsenmetadata internal] load build definition from Dockerfile.metadata.public 0.0s failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount2077333692/Dockerfile.frontend.local: no such file or directory

MGAbbasi123 avatar Nov 17 '22 08:11 MGAbbasi123