neulab / prompt2model

prompt2model - Generate Deployable Models from Natural Language Instructions
Apache License 2.0
1.96k stars 177 forks source link

fatal error: Python.h: No such file or directory #393

Closed 7flash closed 9 months ago

7flash commented 10 months ago

When trying to install prompt2model encounter this error:

pip install prompt2model

  error: subprocess-exited-with-error

  × Building wheel for zlib-state (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/zlib_state
      copying zlib_state/__init__.py -> build/lib.linux-x86_64-cpython-310/zlib_state
      running egg_info
      writing zlib_state.egg-info/PKG-INFO
      writing dependency_links to zlib_state.egg-info/dependency_links.txt
      writing top-level names to zlib_state.egg-info/top_level.txt
      reading manifest file 'zlib_state.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file 'zlib_state.egg-info/SOURCES.txt'
      running build_ext
      building '_zlib_state' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/src
      x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.10 -c src/zlib_state.c -o build/temp.linux-x86_64-cpython-310/src/zlib_state.o
      src/zlib_state.c:2:10: fatal error: Python.h: No such file or directory
          2 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
zhaochenyang20 commented 10 months ago

Thanks for your issue. Have you googled it?

zhaochenyang20 commented 10 months ago

I guess this is something related to your python environment, not on prompt2model. But if you still have problems, we are willing to help.

viswavi commented 10 months ago

Hi @7flash, it would be helpful if you could add what operating system/version you used. Also, are you installing in a virtual environment or directly on your machine?

I was unable to reproduce this error when I tried on an Ubuntu 18.04 machine, on a virtual environment. Googling suggests that you may need to install python-dev, though I'm not sure why this would be.

As Chenyang said, happy to help you with your installation

7flash commented 10 months ago

Hi @7flash, it would be helpful if you could add what operating system/version you used. Also, are you installing in a virtual environment or directly on your machine?

I was unable to reproduce this error when I tried on an Ubuntu 18.04 machine, on a virtual environment. Googling suggests that you may need to install python-dev, though I'm not sure why this would be.

As Chenyang said, happy to help you with your installation

I am running this container in runpod A100-80GB machine

Dockerfile

FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

WORKDIR /

RUN mkdir /workspace

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND noninteractive\
    SHELL=/bin/bash
RUN apt-get update --yes && \
    # - apt-get upgrade is run to patch known vulnerabilities in apt-get packages as
    #   the ubuntu base image is rebuilt too seldom sometimes (less than once a month)
    apt-get upgrade --yes && \
    apt install --yes --no-install-recommends\
    git\
    wget\
    curl\
    bash\
    software-properties-common\
    openssh-server
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt install python3.10 -y --no-install-recommends && \
    ln -s /usr/bin/python3.10 /usr/bin/python && \
    rm /usr/bin/python3 && \
    ln -s /usr/bin/python3.10 /usr/bin/python3 && \
    apt-get clean && rm -rf /var/lib/apt/lists/* && \
    echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python get-pip.py
RUN pip install --no-cache-dir --pre torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --extra-index-url https://download.pytorch.org/whl/nightly/cu118
RUN pip install --no-cache-dir -U jupyterlab ipywidgets jupyter-archive
# RUN jupyter nbextension enable --py widgetsnbextension
RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements"

ADD start.sh /

RUN chmod +x /start.sh

CMD [ "/start.sh" ]
zhaochenyang20 commented 10 months ago

Hello @7flash

https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory

Could you please try this?

7flash commented 10 months ago

Hello @7flash

https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory

Could you please try this?

It says "No matching distribution found for" when trying to "pip install python-dev" or other variations

I saw in another comment that these packages were removed from directory

neubig commented 9 months ago

Hi @7flash : are you able to do pip install torch?

I suspect, as with others above, that this is an issue of your environment more than prompt2model itself.

neubig commented 9 months ago

Closing, but feel free to reopen if this seems to be an issue of prompt2model itself.