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

Installing in Python 2.6.5 yields: No such file or directory: 'README.rst' #57

Closed
hkraal opened this issue Jun 15, 2016 · 17 comments
Closed
Assignees
Labels

Comments

@hkraal
Copy link

hkraal commented Jun 15, 2016

I was testing an application using Ubuntu 10.04 running on docker which couldn't install bitmath.

# pip install bitmath
Downloading/unpacking bitmath
  Running setup.py egg_info for package bitmath
    Traceback (most recent call last):
      File "<string>", line 13, in <module>
      File "/app/build/bitmath/setup.py", line 34, in <module>
        pypi_notice = open('README.rst', 'r').read()
    IOError: [Errno 2] No such file or directory: 'README.rst'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 13, in <module>

  File "/app/build/bitmath/setup.py", line 34, in <module>

    pypi_notice = open('README.rst', 'r').read()

IOError: [Errno 2] No such file or directory: 'README.rst'

----------------------------------------
Command python setup.py egg_info failed with error code 1

System info

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.04 LTS
Release:        10.04
Codename:       lucid

$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2

Reproduce:

docker run -it --rm ubuntu:10.04 /bin/bash

$ sudo apt-get install python-pip
$ sudo pip install bitmath
@tbielawa
Copy link
Owner

I am able to reproduce an error using the technique you described above

$ sudo docker run -it --rm ubuntu:10.04 /bin/bash
Unable to find image 'ubuntu:10.04' locally
Trying to pull repository docker.io/library/ubuntu ... 
10.04: Pulling from docker.io/library/ubuntu

a3ed95caeb02: Pull complete 
86b54f4b6a4e: Pull complete 
Digest: sha256:f6695b2d24dd2e1da0a79fa72459e33505da79939c13ce50e90675c32988ab64
Status: Downloaded newer image for docker.io/ubuntu:10.04

Now, in the container, I run the apt install command:

root@c61dc7d3d87c:/# sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  python-pkg-resources python-setuptools
Suggested packages:
  python-distribute python-distribute-doc
The following NEW packages will be installed:
  python-pip python-pkg-resources python-setuptools
0 upgraded, 3 newly installed, 0 to remove and 67 not upgraded.
Need to get 327kB of archives.
After this operation, 1405kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ lucid/main python-pkg-resources 0.6.10-4ubuntu1 [65.0kB]
Get:2 http://archive.ubuntu.com/ubuntu/ lucid/main python-setuptools 0.6.10-4ubuntu1 [213kB]
Get:3 http://archive.ubuntu.com/ubuntu/ lucid-updates/universe python-pip 0.3.1-1ubuntu2.1 [49.8kB]
Fetched 327kB in 0s (544kB/s)       
Selecting previously deselected package python-pkg-resources.
(Reading database ... 9129 files and directories currently installed.)
Unpacking python-pkg-resources (from .../python-pkg-resources_0.6.10-4ubuntu1_all.deb) ...
Selecting previously deselected package python-setuptools.
Unpacking python-setuptools (from .../python-setuptools_0.6.10-4ubuntu1_all.deb) ...
Selecting previously deselected package python-pip.
Unpacking python-pip (from .../python-pip_0.3.1-1ubuntu2.1_all.deb) ...
Setting up python-pkg-resources (0.6.10-4ubuntu1) ...

Processing triggers for python-central ...
Setting up python-setuptools (0.6.10-4ubuntu1) ...

Processing triggers for python-central ...
Setting up python-pip (0.3.1-1ubuntu2.1) ...

Processing triggers for python-central ...

and then the pip install command:

root@c61dc7d3d87c:/# sudo pip install --log=/tmp/pip-install-bitmath.log bitmath
Downloading/unpacking bitmath
  Downloading bitmath-1.3.0.2.tar.gz (80Kb): 80Kb downloaded
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
    self.run(options, args)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
    requirement_set.install_files(finder, force_root_egg_info=self.bundle)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1757, in install_files
    self.unpack_url(url, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1901, in unpack_url
    self.unpack_file(temp_location, location, content_type, link)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1919, in unpack_file
    self.untar_file(filename, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1988, in untar_file
    fp = tar.extractfile(member)
  File "/usr/lib/python2.6/tarfile.py", line 2122, in extractfile
    tarinfo))
  File "/usr/lib/python2.6/tarfile.py", line 2105, in extractfile
    if tarinfo.isreg():
AttributeError: 'NoneType' object has no attribute 'isreg'

Storing complete log in ./pip-log.txt
Traceback (most recent call last):
  File "/usr/bin/pip", line 3, in <module>
    pip.main()
  File "/usr/lib/python2.6/dist-packages/pip.py", line 893, in main
    return command.main(initial_args, args[1:], options)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 266, in main
    logger.fatal('Storing complete log in %s' % log_fn)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 3353, in fatal
    self.log(self.FATAL, msg, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 3378, in log
    consumer.write(rendered+'\n')
ValueError: I/O operation on closed file

And the log file:

root@c61dc7d3d87c:/# cat /tmp/pip-install-bitmath.log
Downloading/unpacking bitmath
  Getting page http://pypi.python.org/simple/bitmath
  URLs to search for versions for bitmath:
  * http://pypi.python.org/simple/bitmath
  Analyzing links from page https://pypi.python.org/simple/bitmath/
    Found link https://pypi.python.org/packages/01/58/9ed1054d062bc8c12a7062090c319226b535f6343ffbb4aad158db4ef969/bitmath-1.0.7-1.tar.gz#md5=d06298f19e575172670f5c2bc19ff9ed (from https://pypi.python.org/simple/bitmath/), version: 1.0.7-1
    Found link https://pypi.python.org/packages/3a/64/9d702425d157370775e8eb9ab117bc92cd08386d3322498ee218d28657e4/bitmath-1.2.0-1.tar.gz#md5=8d77cab520b33269fe1d9c880cc7dc19 (from https://pypi.python.org/simple/bitmath/), version: 1.2.0-1
    Found link https://pypi.python.org/packages/47/5f/5487e80b1ab5709e442eb64088de269970b962fb3b492175c22dbdfa95f0/bitmath-1.3.0.2.tar.gz#md5=5a385eb5c97e97d67406b8c26ca0ac6f (from https://pypi.python.org/simple/bitmath/), version: 1.3.0.2
    Found link https://pypi.python.org/packages/5a/8f/9458ba727761d3a6f43295e470a2008fbaf223964a518956713a49567810/bitmath-1.0.4-1.tar.gz#md5=f3142491cb29cda9fda775447cdd328e (from https://pypi.python.org/simple/bitmath/), version: 1.0.4-1
    Found link https://pypi.python.org/packages/76/b1/9d83bc67f8c9374cda4a836026ade50ae6fbcdcc4d43a1749af9eaca05f2/bitmath-1.0.5-1.tar.gz#md5=1b109df7571af18bfc22a118e0884b11 (from https://pypi.python.org/simple/bitmath/), version: 1.0.5-1
    Found link https://pypi.python.org/packages/77/27/bf4741c052110abc81738fdf76852506f8120ac0e745668a500e6df75c4a/bitmath-1.2.3-4.tar.gz#md5=4a8818c1a830a7aa0eac92b10016787e (from https://pypi.python.org/simple/bitmath/), version: 1.2.3-4
    Found link https://pypi.python.org/packages/79/f7/ba773bef6d800f85267e35853af41bb1aa7eb450709e86e4fad6088447ed/bitmath-1.0.2-3.tar.gz#md5=dd2387bcafb32f9e73bf7bd98a36cbf0 (from https://pypi.python.org/simple/bitmath/), version: 1.0.2-3
    Found link https://pypi.python.org/packages/7a/1c/a93d5643590159627ad77330464bd64c5ba9cf494a852473d7f0444d7748/bitmath-1.0.2.tar.gz#md5=5f8427ca3a72c6c500db6172992cf910 (from https://pypi.python.org/simple/bitmath/), version: 1.0.2
    Found link https://pypi.python.org/packages/7d/c9/5104ab6f3c01143f0e83d40afb091d69350f4e8b7abbaaaa5071dc0ca747/bitmath-1.3.0.1.tar.gz#md5=20264b776873057c61e919999dac6053 (from https://pypi.python.org/simple/bitmath/), version: 1.3.0.1
    Found link https://pypi.python.org/packages/80/39/5639a3d6126fbf072fb47565db66a05c4ecec2c9f1970bbbc666faff064f/bitmath-1.2.4.1.tar.gz#md5=58fc16f65c806bcc9c0d97b027b2e45f (from https://pypi.python.org/simple/bitmath/), version: 1.2.4.1
    Found link https://pypi.python.org/packages/ac/80/b7e0c2dd960fa41e808d430a0442e6f7c231cd49e2f91b77614be8a7166f/bitmath-1.0.8-1.tar.gz#md5=401160a48a6ec3a0f22bf988d7f6f6f3 (from https://pypi.python.org/simple/bitmath/), version: 1.0.8-1
    Found link https://pypi.python.org/packages/bb/cf/f1e9b68c5c5912b734a772b3e41f4b258f6415227759f3a77a1b36a954a5/bitmath-1.2.3-1.tar.gz#md5=e0caf1b666e652794ae2d73f7315af3a (from https://pypi.python.org/simple/bitmath/), version: 1.2.3-1
    Found link https://pypi.python.org/packages/d3/c2/8dff82313550abefe1f5262e98796167e53f678d6b2c618ac4e9d68866af/bitmath-1.1.0-1.tar.gz#md5=fcbdb846f3e27c175c90c5b4fa883454 (from https://pypi.python.org/simple/bitmath/), version: 1.1.0-1
    Found link https://pypi.python.org/packages/ff/26/ff05e5ca862de04732b5ec493f97a11492d6a2671f2130dd328548f4eaf6/bitmath-1.0.6-1.tar.gz#md5=2ad036f8dc3356e857e9598b69f5e90f (from https://pypi.python.org/simple/bitmath/), version: 1.0.6-1
  Using version 1.3.0.2 (newest of versions: 1.3.0.2, 1.3.0.1, 1.2.4.1, 1.2.3-4, 1.2.3-1, 1.2.0-1, 1.1.0-1, 1.0.8-1, 1.0.7-1, 1.0.6-1, 1.0.5-1, 1.0.4-1, 1.0.2-3, 1.0.2)
  Downloading from URL https://pypi.python.org/packages/47/5f/5487e80b1ab5709e442eb64088de269970b962fb3b492175c22dbdfa95f0/bitmath-1.3.0.2.tar.gz#md5=5a385eb5c97e97d67406b8c26ca0ac6f (from https://pypi.python.org/simple/bitmath/)
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
    self.run(options, args)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
    requirement_set.install_files(finder, force_root_egg_info=self.bundle)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1757, in install_files
    self.unpack_url(url, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1901, in unpack_url
    self.unpack_file(temp_location, location, content_type, link)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1919, in unpack_file
    self.untar_file(filename, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1988, in untar_file
    fp = tar.extractfile(member)
  File "/usr/lib/python2.6/tarfile.py", line 2122, in extractfile
    tarinfo))
  File "/usr/lib/python2.6/tarfile.py", line 2105, in extractfile
    if tarinfo.isreg():
AttributeError: 'NoneType' object has no attribute 'isreg'

I'm not sure what all that means yet. I'm going to examine this closer later today or tomorrow. Thanks for the report, I'll get back to you asap.

I did notice one thing though, the python version on that 10.04 host is Python 2.6.5 and bitmath is only verified and tested for python 2.7 and 3.x (https://travis-ci.org/tbielawa/bitmath/builds/133980143)

@hkraal
Copy link
Author

hkraal commented Jun 17, 2016

Awesome, I've been attempting to tackle it as well, if and when I do get clou I'll let you know or send in a PR.

On the python version part; I looked at the classifiers in the setup.py which lists 2.6 (among others) as a valid Python version. When installing bitmath from source Python 2.6 seems to work (at least partially) as my unittests checking some MB-GB conversions are all running well.

@tbielawa
Copy link
Owner

Oh snap! I forgot about the classifiers, too.

Ill poke at this for a while today. Surely one of us will find a good
workaround :)
On Jun 17, 2016 3:08 AM, "Henk Kraal" notifications@github.com wrote:

Awesome, I've been attempting to tackle it as well, if and when I do get
clou I'll let you know or send in a PR.

On the python version part; I looked at the classifiers in the setup.py
which lists 2.6 (among others) as a valid Python version. When installing
bitmath from source Python 2.6 seems to work (at least partially) as my
unittests checking some MB-GB conversions are all running well.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#57 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AACBYT9-JvwUI2dBDX52aK7yakbCK74iks5qMkf2gaJpZM4I2fCd
.

@tbielawa
Copy link
Owner

Hm. It's not a fix, but I was able to get the package installed from pip. Sorta... Here's what I found (and don't understand). Maybe this is the same process you followed to install it.

Straight pip install - Error

root@ip-10-181-213-77:~# pip install bitmath
Downloading/unpacking bitmath
  Downloading bitmath-1.3.0.2.tar.gz (80Kb): 80Kb downloaded
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
    self.run(options, args)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
    requirement_set.install_files(finder, force_root_egg_info=self.bundle)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1757, in install_files
    self.unpack_url(url, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1901, in unpack_url
    self.unpack_file(temp_location, location, content_type, link)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1919, in unpack_file
    self.untar_file(filename, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1988, in untar_file
    fp = tar.extractfile(member)
  File "/usr/lib/python2.6/tarfile.py", line 2122, in extractfile
    tarinfo))
  File "/usr/lib/python2.6/tarfile.py", line 2105, in extractfile
    if tarinfo.isreg():
AttributeError: 'NoneType' object has no attribute 'isreg'

Pip Install With Source gz - Error

root@ip-10-181-213-77:~# cd `mktemp -d`

root@ip-10-181-213-77:/tmp/tmp.zpPoa5OM0N# wget --no-check-certificate https://pypi.python.org/packages/47/5f/5487e80b1ab5709e442eb64088de269970b962fb3b492175c22dbdfa95f0/bitmath-1.3.0.2.tar.gz#md5=5a385eb5c97e97d67406b8c26ca0ac6f
--2016-06-18 17:24:22--  https://pypi.python.org/packages/47/5f/5487e80b1ab5709e442eb64088de269970b962fb3b492175c22dbdfa95f0/bitmath-1.3.0.2.tar.gz
Resolving pypi.python.org... 151.101.20.223
Connecting to pypi.python.org|151.101.20.223|:443... connected.
WARNING: certificate common name `www.python.org' doesn't match requested host name `pypi.python.org'.
HTTP request sent, awaiting response... 200 OK
Length: 80974 (79K) [application/octet-stream]
Saving to: `bitmath-1.3.0.2.tar.gz'

100%[========================>] 80,974      --.-K/s   in 0.02s

2016-06-18 17:24:22 (4.82 MB/s) - `bitmath-1.3.0.2.tar.gz' saved [80974/80974]

root@ip-10-181-213-77:/tmp/tmp.zpPoa5OM0N# ls
bitmath-1.3.0.2.tar.gz

root@ip-10-181-213-77:/tmp/tmp.zpPoa5OM0N# pip install ./bitmath-1.3.0.2.tar.gz
Unpacking ./bitmath-1.3.0.2.tar.gz
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
    self.run(options, args)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
    requirement_set.install_files(finder, force_root_egg_info=self.bundle)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1757, in install_files
    self.unpack_url(url, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1817, in unpack_url
    self.unpack_file(source, location, content_type, link)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1919, in unpack_file
    self.untar_file(filename, location)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1988, in untar_file
    fp = tar.extractfile(member)
  File "/usr/lib/python2.6/tarfile.py", line 2122, in extractfile
    tarinfo))
  File "/usr/lib/python2.6/tarfile.py", line 2105, in extractfile
    if tarinfo.isreg():
AttributeError: 'NoneType' object has no attribute 'isreg'

Storing complete log in ./pip-log.txt

Python setup.py Install With Source gz DECOMPRESSED - Success:

root@ip-10-181-213-77:~# cd `mktemp -d`

root@ip-10-181-213-77:/tmp/tmp.wQlV7RvwnK# wget --no-check-certificate https://pypi.python.org/packages/47/5f/5487e80b1ab5709e442eb64088de269970b962fb3b492175c22dbdfa95f0/bitmath-1.3.0.2.tar.gz#md5=5a385eb5c97e97d67406b8c26ca0ac6f
--2016-06-18 17:24:39--  https://pypi.python.org/packages/47/5f/5487e80b1ab5709e442eb64088de269970b962fb3b492175c22dbdfa95f0/bitmath-1.3.0.2.tar.gz
Resolving pypi.python.org... 151.101.20.223
Connecting to pypi.python.org|151.101.20.223|:443... connected.
WARNING: certificate common name `www.python.org' doesn't match requested host name `pypi.python.org'.
HTTP request sent, awaiting response... 200 OK
Length: 80974 (79K) [application/octet-stream]
Saving to: `bitmath-1.3.0.2.tar.gz'

100%[===========================>] 80,974      --.-K/s   in 0.02s

2016-06-18 17:24:39 (4.84 MB/s) - `bitmath-1.3.0.2.tar.gz' saved [80974/80974]

root@ip-10-181-213-77:/tmp/tmp.wQlV7RvwnK# tar -xf ./bitmath-1.3.0.2.tar.gz
root@ip-10-181-213-77:/tmp/tmp.wQlV7RvwnK# cd ./bitmath-1.3.0.2

root@ip-10-181-213-77:/tmp/tmp.wQlV7RvwnK/bitmath-1.3.0.2# python ./setup.py install
running install
running bdist_egg
running egg_info
writing bitmath.egg-info/PKG-INFO
writing top-level names to bitmath.egg-info/top_level.txt  
writing dependency_links to bitmath.egg-info/dependency_links.txt
writing entry points to bitmath.egg-info/entry_points.txt  
reading manifest file 'bitmath.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bitmath.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.6
creating build/lib.linux-x86_64-2.6/bitmath
copying bitmath/__init__.py -> build/lib.linux-x86_64-2.6/bitmath
copying bitmath/integrations.py -> build/lib.linux-x86_64-2.6/bitmath
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/bitmath
copying build/lib.linux-x86_64-2.6/bitmath/__init__.py -> build/bdist.linux-x86_64/egg/bitmath
copying build/lib.linux-x86_64-2.6/bitmath/integrations.py -> build/bdist.linux-x86_64/egg/bitmath
byte-compiling build/bdist.linux-x86_64/egg/bitmath/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitmath/integrations.py to integrations.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying bitmath.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitmath.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitmath.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitmath.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitmath.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/bitmath-1.3.0.2-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing bitmath-1.3.0.2-py2.6.egg
creating /usr/local/lib/python2.6/dist-packages/bitmath-1.3.0.2-py2.6.egg
Extracting bitmath-1.3.0.2-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Adding bitmath 1.3.0.2 to easy-install.pth file
Installing bitmath script to /usr/local/bin

Installed /usr/local/lib/python2.6/dist-packages/bitmath-1.3.0.2-py2.6.egg
Processing dependencies for bitmath==1.3.0.2
Finished processing dependencies for bitmath==1.3.0.2

In this final way (above), bitmath installed by:

This is so strange to me. Just earlier this year in commit 0978c32 (or 883b411) we were able to make some changes that fixed 2.6 compat in unittests.

Why won't this install FROM pip? Why is the tar utility not recognizing the README.rst file? That's got to be what's causing the

IOError: [Errno 2] No such file or directory: 'README.rst'

and subsequent

  File "/usr/lib/python2.6/tarfile.py", line 2122, in extractfile
    tarinfo))
  File "/usr/lib/python2.6/tarfile.py", line 2105, in extractfile
    if tarinfo.isreg():
AttributeError: 'NoneType' object has no attribute 'isreg'

Error.

@hkraal
Copy link
Author

hkraal commented Jun 19, 2016

Jackpot; the issue is cause by the use of symlinks in the project:

# git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    docsite/source/NEWS.rst
        deleted:    docsite/source/full_demo.py
        deleted:    tests/listdir_symlinks/10_byte_file_link

Steps to reproduce an succes:

# Mount the bitmath project under /app
root@test01:~/projects/bitmath # docker --rm -it -v $(pwd):/app ubuntu:10.04 /bin/bash

root@e8c8310f5b35:/ # apt-get update && apt-get -y install python-pip
root@e8c8310f5b35:/ # cd /app/
root@e8c8310f5b35:/app # find ./ -type l -delete
root@e8c8310f5b35:/app # python setup.py sdist
root@e8c8310f5b35:/app # pip install dist/bitmath-1.3.0.2.tar.gz
root@e8c8310f5b35:/app # pip freeze
bitmath==1.3.0.2
distribute==0.6.10
wsgiref==0.1.2

@tbielawa
Copy link
Owner

WHOA! That's a brilliant find! Nice, Henk!

I suspected something like that too, from some internet review. Never
thought to actually try it out though.

I'm going to reproduce your new test case and then see if i can find some
compatible workaround. Ill keep my eye on my inbox incase you're already
working on something.
On Jun 19, 2016 6:50 AM, "Henk Kraal" notifications@github.com wrote:

Jackpot; the issue is cause by the use of symlinks in the project:

git status

On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
(use "git add/rm ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

    deleted:    docsite/source/NEWS.rst
    deleted:    docsite/source/full_demo.py
    deleted:    tests/listdir_symlinks/10_byte_file_link

Steps to reproduce an succes:

Mount the bitmath project under /app

root@test01:~/projects/bitmath # docker --rm -it -v $(pwd):/app ubuntu:10.04 /bin/bash

root@e8c8310f5b35:/ # apt-get update && apt-get -y install python-pip
root@e8c8310f5b35:/ # cd /app/
root@e8c8310f5b35:/app # find ./ -type l -delete
root@e8c8310f5b35:/app # python setup.py sdist
root@e8c8310f5b35:/app # pip install dist/bitmath-1.3.0.2.tar.gz
root@e8c8310f5b35:/app # pip freeze
bitmath==1.3.0.2
distribute==0.6.10
wsgiref==0.1.2


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#57 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AACBYbazj4bRqhH2IrltLaDZwoMzw1p5ks5qNR75gaJpZM4I2fCd
.

@tbielawa
Copy link
Owner

I just did some more internet scouring. Since this works in different versions I suspected somewhere in time that either the tarfile module or pip itself changed some fundamental behavior. There were no Changed in type notes between the Python 2.6 and 2.7 tarfile docs about changing symlink handling. So I checked out pip instead.

In our reference container (ubuntu:10.04) python-pip is version 0.3.1-1ubuntu2.1.

Check out the pip Release Notes page. Latest version is 8.1.2 from 2016-05-10. The version in 10.04 is laughably out of date. 0.3.1 doesn't even have a release date listed.

Aside: The first release with a date is actually their 1.0 release (early 2011). If you look through git hard enough you can eventually find commit pypa/pip@d5b6bbe on Jan 29, 2009 where the release string changes from 0.3 to 0.3.1.

BUT, going back to the release notes, there is a little gem in there. Find the 1.1 release from 2012-02-16 on the page. There's one change in there very apropos to our issue:

The suggested patch in that issue actually was merged in PR #293.

Hm. Now to find a work around.

@tbielawa
Copy link
Owner

I was able to reproduce the test you gave in your last comment @hkraal (did have to add the run subcommand, but you get the idea).

@tbielawa
Copy link
Owner

Now I gotta just figure out what to do about the symlink in the tests directory. That's kind of, well, required for tests.

I guess the test dir doesn't need to be included for PyPi distributions. I just need see if excluding graft tests from the MANIFEST.in file causes RPM building errors, and then how to fix those if that happens.

@tbielawa
Copy link
Owner

Yep. As expected. Removing the tests dir from the manifest file causes undesired side-effects on the RPM build:

Bytecompiling .py files below /home/tbielawa/Projects/bitmath/rpm-build/BUILDROOT/python-bitmath-1.3.0-2.fc23.x86_64/usr/lib/python2.7 using /usr/bin/python2.7
+ /usr/lib/rpm/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.ZAHkGX
+ umask 022
+ cd /home/tbielawa/Projects/bitmath/rpm-build
+ cd bitmath-1.3.0.2
+ nosetests -v

----------------------------------------------------------------------
Ran 0 tests in 0.008s

OK
+ nosetests-3.4 -e test_FileTransferSpeed -e test_BitmathType_ -I '.*test_argparse_type.py' -I '.*test_progressbar.py' -v

----------------------------------------------------------------------
Ran 0 tests in 0.010s

OK
+ exit 0
Processing files: python2-bitmath-1.3.0-2.fc23.noarch

Ran 0 tests...

@tbielawa
Copy link
Owner

Hm. I got a hacky work-around in place that generates setup.py files for RPM vs. PyPi distribution. bitmath-1.3.0.3 is up on Test PyPi now

In the ubuntu:10.04 container I install python-pip and then install bitmath from TEST pypi like this:

root@b857501e8fd1:/# pip install -i https://testpypi.python.org/pypi bitmath
Downloading/unpacking bitmath
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.6/threading.py", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1115, in _get_queued_page
    for link in page.rel_links():
  File "/usr/lib/python2.6/dist-packages/pip.py", line 2226, in rel_links
    for url in self.scraped_rel_links():
  File "/usr/lib/python2.6/dist-packages/pip.py", line 2253, in scraped_rel_links
    url = match.group(1) or match.group(2) or match.group(3)
IndexError: no such group

  Downloading bitmath-1.3.0.3.tar.gz (64Kb): 64Kb downloaded
  Running setup.py egg_info for package bitmath
Installing collected packages: bitmath
  Running setup.py install for bitmath
    Installing bitmath script to /usr/local/bin
Successfully installed bitmath

There's a weird error message there about regex group matching. I think it's possibly related to pypa/pip#366 which must have been fixed in a later version of pip than what's in ubuntu 10.04.

One other issue though, argparse isn't available by default

root@b857501e8fd1:/# python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bitmath
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/bitmath/__init__.py", line 55, in <module>
    import argparse
ImportError: No module named argparse

Install argparse and try again, much better!

root@b857501e8fd1:/# apt-get install python-argparse
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  python-support
Suggested packages:
  python-argparse-doc
The following NEW packages will be installed:
  python-argparse python-support
0 upgraded, 2 newly installed, 0 to remove and 70 not upgraded.
Need to get 75.3kB of archives.
After this operation, 512kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ lucid/main python-support 1.0.4ubuntu1 [32.0kB]
...
Setting up python-support (1.0.4ubuntu1) ...
Setting up python-argparse (1.1-1) ...
Processing triggers for python-support ...

root@b857501e8fd1:/# python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bitmath
>>> print bitmath.best_prefix(13378675309)
12.4598623337 GiB

@hkraal can you give this a test for me (Install bitmath 1.3.0.3 from test pypi)

pip install -i https://testpypi.python.org/pypi bitmath

@hkraal
Copy link
Author

hkraal commented Jun 21, 2016

Whoa, nice digging!

Although I'm getting an error thrown at me the package does install and seems to be functional when running it inside a docker container. The bitmath==1.3.0.3 package would mark this issue as fixed as far as I'm concerned, fixing the error below is a nice to have but not required for me personally.

root@2037a67741c3:/# pip install -i https://testpypi.python.org/pypi bitmath
Downloading/unpacking bitmath
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.6/threading.py", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1115, in _get_queued_page
    for link in page.rel_links():
  File "/usr/lib/python2.6/dist-packages/pip.py", line 2226, in rel_links
    for url in self.scraped_rel_links():
  File "/usr/lib/python2.6/dist-packages/pip.py", line 2253, in scraped_rel_links
    url = match.group(1) or match.group(2) or match.group(3)
IndexError: no such group

  Downloading bitmath-1.3.0.3.tar.gz (64Kb): 64Kb downloaded
  Running setup.py egg_info for package bitmath
Installing collected packages: bitmath
  Running setup.py install for bitmath
    Installing bitmath script to /usr/local/bin
Successfully installed bitmath

Because the core of this issue is related to a old (ancient might be a better term) pip version I tried another route by installing pip using get-pip.py:

$ docker run -it --rm -v $(pwd):/app ubuntu:10.04 /bin/bash

root@63e4552d5b43:/# apt-get update && apt-get -y install curl

root@63e4552d5b43:/# curl https://bootstrap.pypa.io/get-pip.py | python

root@63e4552d5b43:/# pip install bitmath
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting bitmath
  Downloading bitmath-1.3.0.2.tar.gz (80kB)
    100% |################################| 81kB 5.6MB/s
Building wheels for collected packages: bitmath
  Running setup.py bdist_wheel for bitmath ... done
  Stored in directory: /.cache/pip/wheels/c3/c9/48/1d56019ad668467ba26ce61f7f9d987f621b4b1ed33a1c5695
Successfully built bitmath
Installing collected packages: bitmath
Successfully installed bitmath-1.3.0.2

And it run without a hitch as well

@tbielawa
Copy link
Owner

Hooooooooooooooooooooooooooooooooooooooooooooold up. I've seen your log output happen to me once too, in a sort of way. Look close at the end there. Look close:

Successfully installed bitmath-1.3.0.2

That must have came from the production pypi repository. Does get-pip.py support the -i https://testpypi.python.org/pypi option to indicate to install from the test pypi repository?

@tbielawa tbielawa added the bug label Jun 21, 2016
@tbielawa tbielawa self-assigned this Jun 21, 2016
@hkraal
Copy link
Author

hkraal commented Jun 21, 2016

I've installed the latest Pip version using the installed rather than the Ubuntu package manager's Pip. This way we don't run into the old Pip version bug surrounding symlinks and your 1.3.0.2 version installs without any hassle.

So we've go 2 options to choose from to solve this problem:

  • Install bitmath 1.3.0.3
  • Install a newer Pip version using the bootstrap installer

@hkraal
Copy link
Author

hkraal commented Jun 28, 2016

@tbielawa Is there anything I can do to help with this issue? Would you like to close it and be done with it or should we keep going for a working solution?

@tbielawa
Copy link
Owner

Since that's quite an old system we're taking about I'm going to put the
brakes on further attempts to make this fully backwards compatible.

But I think the least we can do is make a note in the install instruction
section.

I've been thinking about putting my debian packaging hat back on for a
while and producing some debs for a ppa. I think that'd be the ultimate
solution. And probably help bitmath reach a larger audience too.
On Jun 28, 2016 4:08 PM, "Henk Kraal" notifications@github.com wrote:

@tbielawa https://github.com/tbielawa Is there anything I can do to
help with this issue? Would you like to close it and be done with it or
should we keep going for a working solution?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#57 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AACBYZlv5y3yqAaw09GG4X1cO0hVKVTYks5qQX8tgaJpZM4I2fCd
.

@tbielawa
Copy link
Owner

@hkraal docs are updated. You can see the note about pypi on the readthedocs page

http://bitmath.readthedocs.io/en/latest/

as well as in the README for the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants