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

PyO3 has a build dependency on Python 2 #584

Closed
vadixidav opened this issue Aug 29, 2019 · 1 comment
Closed

PyO3 has a build dependency on Python 2 #584

vadixidav opened this issue Aug 29, 2019 · 1 comment

Comments

@vadixidav
Copy link

🌍 Environment

FROM ubuntu:18.04 as build

# Install dependencies.
RUN set -eux; \
    apt-get update \
    && apt-get install -y --no-install-recommends \
    pkg-config \
    libssl-dev \
    curl \
    ca-certificates \
    gcc \
    libc-dev \
    python3-dev \
    && rm -rf /var/lib/apt/lists/*
ENV LANG en_US.utf8

# Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2019-08-28-x86_64-unknown-linux-gnu -y
ENV PATH "/root/.cargo/bin:$PATH"

💥 Reproducing

Add this dependency:

pyo3 = "0.7.0"

Now build your code. You will see the following:

error: failed to run custom build command for `pyo3 v0.7.0`

Caused by:
  process didn't exit successfully: `/web/target/release/build/pyo3-23c79148396499f4/build-script-build` (exit code: 1)
--- stderr
Error: "Could not find any interpreter at python, are you sure you have python installed on your PATH?"

Workaround

I was able to fix this temporarily by adding the following to my Dockerfile:

# Force python to be python3.
RUN rm -f /usr/bin/python && ln -s /usr/bin/python3 /usr/bin/python

I notice that on the main README.md it is stated to run the following on Ubuntu:

sudo apt install python3-dev python-dev

However, I would prefer to only install python3-dev to minimize downloads, build time, etc for Docker. I feel like if just linking python to python3 works, it should probably also support discovering python3 and running python3 on the system.

Basically, another way to word this ticket is "Remove build dependency on Python 2".

@kngwyu kngwyu mentioned this issue Sep 7, 2019
@kngwyu
Copy link
Member

kngwyu commented Sep 28, 2019

Closed via #596

@kngwyu kngwyu closed this as completed Sep 28, 2019
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