-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
protobuf-3.0.0
is missing _ _init_ _.py
, and is not recognized by Python v2.7.6
#4352
Comments
@zafields There is nothing to "fix" on our end, the issue is twofold:
So the usage of a non-namespace package ( I'm happy to continue the discussion about namespace packages here, but the only resolution is what is already being discussed in #4345: we need to contact the owners of the I'd also note, if you don't need the functionality in that package ( |
@dhermes I am creating new environments each time, so there is no need to uninstall |
@zafields The issue you've enumerated above is a common issue with "failed" installs of namespace packages. Can you create a
For an example of the "nuts-and-bolts" of a namespace package see the source of |
# Filename: Dockerfile
# Base Image
FROM ubuntu:14.04
# Build Arguments
ARG PYTHON_VERSION=2.7.6
ARG PYTHON_MD5=bcf93efa8eaf383c98ed3ce40b763497
# Set execution environment
COPY ./requirements.txt /tmp/requirements.txt
ENV PYTHONPATH=/usr/local/lib/python2.7/dist-packages:$PYTHONPATH
WORKDIR /projects/
# Install Python Dependencies
RUN ["/bin/dash","-c","\
apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends -y \
ca-certificates \
curl \
g++ \
libssl-dev \
make \
python-pip \
xz-utils \
&& rm -rf /var/lib/apt/lists/* \
"]
# Install Python
# NOTE: Proper format of checksum validation `<md5sum_checksum><space><space><file_name>`
RUN ["/bin/dash","-c","\
cd /projects/ \
&& curl -sSL \"https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz\" -o ./python.tar.xz \
&& echo \"$PYTHON_MD5 ./python.tar.xz\" | md5sum -c - \
&& tar -xf python.tar.xz --xz \
&& rm python.tar.xz \
&& cd /projects/Python-$PYTHON_VERSION \
&& ./configure --enable-unicode=ucs4 --prefix=/usr/local/ \
&& make \
&& make install \
&& cd /projects/ \
&& rm -rf Python-$PYTHON_VERSION \
"]
# Install PIP dependencies
RUN ["/bin/bash","-c","\
pip install pip --upgrade \
&& pip install -r /tmp/requirements.txt \
"]
# Finalize environment
RUN ["/bin/bash", "-c","\
echo 'Defaults env_keep += \"PYTHONPATH\"' >> /etc/sudoers \
# && touch /usr/local/lib/python2.7/dist-packages/google/__init__.py \
"] |
@dhermes Above is the Dockerfile I'm using to reproduce this behavior.
|
@zafields For the purposes of me reproducing, only Can you share what's in ASIDE: Python 2.7.14 was released about a month ago (Sept. 16, 2017) while 2.7.6 is 4 years old (Nov. 10, 2013). If you are the "master of your container" then I recommend upgrading. |
@dhermes According to the discussion on #4247, the final line of the Dockerfile (commented out) should not be necessary, however it is required by the containerized environment I've outlined above (I provided the Dockerfile so you can reproduce the behavior exactly). The relevant members of my
I will say, I fully assume this problem originates from the ancient version of Python, which is why I included it in the title of the issue. However, we have customers we support using |
@dhermes Can we leave this issue open until you have reproduced it, and confirmed it is not an issue with your integration with Docker or Python 2.7.6? |
I just attempted to reproduce in a 2.7.6
|
@dhermes My container installs everything successfully. I have a runtime error. Did you run your unit-tests? |
See the final line, I successfully imported the failure you encountered:
|
@dhermes Can see it works with Docker is super important to our infrastructure. Are you able to use Docker and the Dockerfile I've provided? Would it be best if I create a new issue with Docker in the title and we try to tackle it there? |
I modified your At this point, I would suggest starting with just |
Can you fix your link to the gist? Also, are you using Windows, Linux or Mac? |
Updated with the link (I hit enter a little too early). I am using Ubuntu 16.04 LTS. |
Is |
@zafields no, it's not hosted (the image is 472MB, hosting doesn't make sense when the build should be reproduce-able). At this point, I don't have much else to offer. It's clear there is a collision with the packages you listed and some other (as of now unknown) packages. I've offered you my advice: start with something that works and build up. The issue is not in the Docker container and not with the older version of Python 2.7. The issue is with the package list. (Or possibly you have a broken / old |
Yup. I've got your container running. I just wanted to make sure I didn't even have a chance of a bad copy/paste. Thank you for your trouble. I'll work through it and report back what I find. |
To come full circle, the import failure appears to be a result of the difference in the way we chose to install Interestingly, the manual method results in Manual:
Stackoverflow: What's the difference between dist-packages and site-packages? offers a succinct explanation of Python's Lee Mendelowitz: How does python find packages? does great job of detailing the mechanism and shows the source behind Debian's implementation. Actionable Items Perhaps if you will have a look at the Debian @dhermes Would you mind to reopen this issue until we have fully outlined the source and solution to this packaging discrepancy, or would you like for me to start fresh with *typo on the Dockerfile I provided to you - now updated |
(I have updated my gist with your Dockerfile as well.)
Also,
There is no reason to reopen this issue, there is no problem with how we are using namespace packages. There may be some "issue" with |
The reason we closed the issue is because, as best as we can determine, it is not a bug or issue with our libraries. We will be happy to re-open it if we have probable cause to believe there is a bug to be fixed on our side. |
@dhermes Thank you for the excellent description of the problem in your last comment. Now that we have root caused the problem and you have identified the solution I consider this issue Closed. I am sorry for being so persistent, but you had marked this issue closed < 2 mins after it was opened and long before you arrived at your first, incorrect guesses. Guess 1.
Guess 2.
I think it's reasonable to say, you closed the issue long before you understood my problem. Ultimately, you were correct and your packages were just fine. However, when someone can't consume your packages when doing a reasonable (albeit naive) progression, it is YOUR problem. If people can't consume your code, that's a problem. Once indexed, I think this long and thorough discussion will help several others who may well run into this EXACT same problem. Again, I really do appreciate your time and effort, thank you for walking me through this problem. |
Yes, that's true. But keep in mind I also understand we are packaging our namespace packages correctly and that I've seen a lot of |
From Python 2.7.6., the package results in the following error:
In order to get the package to become discoverable, I had to add an empty
__init__.py
file to thesite-packages/google
directory.Here is the stackoverflow post that led me to the solution, and it is also the post that directs everyone to use the
google
package that is incorrectly attributed to you (#4345).The text was updated successfully, but these errors were encountered: