Tahoe-lafs fails to start with python 2.7 due to missing argparse module #1714
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#1714
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
But since python 2.7 argparse is included in standard library: http://www.python.org/dev/peps/pep-0389/, so my system does not have separate module for argparse.
Out of curiosity, what operating system is this?
(I suspect that this is another setuptools-ish problem. I don't believe that the python standard library is expected to provide pkg-info metadata for its contents, which makes it hard to use pkg_resources to detect availability of such modules).
It is not setuptools' responsibility to detect the standard library version of argparse, or the responsibility of that version to provide pkg-info metadata. What is supposed to happen, I believe, is that the argparse package is always built (if not installed as a package) when building dependencies of zfec, and that the version so built should work fine on Python 2.7. It is not intended that the standard library version be used by zfec (but if it were, as a result of a strangely configured sys.path for example, it wouldn't matter because the standard library version of argparse is compatible with the package version; and besides Tahoe doesn't use the zfec command-line tools).
vrusinov: how did you install Tahoe? If you installed it from an OS package, then that package is broken because it should have declared a dependency on the argparse package regardless of whether the OS has Python 2.7.
If you installed it using 'python setup.py build', then it should have downloaded and built the argparse package, again regardless of whether the OS has Python 2.7.
We can also change zfec to declare a dependency on the argparse package only if the argparse module can't be imported. This would be analogous to the way Tahoe-LAFS [declares a dependency on the pysqlite package]source:git/src/allmydata/_auto_deps.py?annotate=blame&rev=cef646c4a70537d618459044ea0a8b590732ca90#L80 only if the
sqlite3
module can't be imported.A simpler solution to this problem is to require Python 2.7! I'm excited about Python 2.7 because the Python developers have sworn to stop improving the Python 2 line.
Realistically, though, it will probably be years before we're willing to tell people they can't run Tahoe-LAFS with the Python 2.6 that came with their operating system. See #1658 (drop support for Python < 2.6) for a ticket where we are dithering about when to drop support for Python < 2.6. To simplify the subject of this ticket we would also have to drop support for Python < 2.7.
Hey waitaminute. I went to implement my idea from comment:88164 to have
zfec
declare a dependency on theargparse
package only if theargparse
module couldn't be imported. However, I discovered thatzfec
already [//trac/zfec/browser/trunk/zfec/setup.py?annotate=blame&rev=390#L156 declares a dependency on argparse only if Python < 2.7]. So how did you get a version of zfec installed into your system that says that it requires theargparse
package? My guess is that you installed zfec with Python 2.6 and then upgraded your system to Python 2.7. I guess this shows that the hack of "try to import theargparse
module and, if that doesn't work, declare a dependency on theargparse
package" is more robust.Assigning to vrusinov to see if he can explain how his install of
zfec
has this dependency onargparse
even though he has Python 2.7. (Hint: where iszfec
located? You can tell with $python -c 'import zfec;print zfec'
.)Oh, another explanation would be that you have a version of
zfec
from before its dependency onargparse
was conditionalized. That would be... let's see...[//trac/zfec/changeset/390/trunk https://tahoe-lafs.org/trac/zfec/changeset/390/trunk]
Oh dear... I guess I haven't made a new release of zfec in the 13 months since I committed that patch.
Okay, so a good next step would be for me to edit
zfec
to use the "try import and then fallback to require" approach instead of the "Python < 2.7" approach, and then make a new release of zfec.Replying to zooko:
Why is that change needed? Just making a new release of zfec as-is would solve the problem, no?
(I'm generally -1 on attempting to import modules that are normally only runtime dependencies at build time.)
BTW, making a new release of zfec will not help if vrusinov's (or anyone else's with the same problem) system is using the OS-packaged zfec. So we still need to know how vrusinov installed Tahoe.
Oh, and zooko: you have a habit of getting halfway through a comment and finding out something that negates the evidence for a previous hypothesis (e.g. "My guess is that you installed zfec with Python 2.6..." above), and then not editing or
striking outthe hypothesis. It's confusing!Okay, I've posted zfec v1.4.23 which hopefully fixes this problem. vrusinov: please try again!
Replying to davidsarah:
Sorry! You're right.
Replying to [davidsarah]comment:6:
I guess my main reason was that I wanted
zfec
's build system to be more likeTahoe-LAFS
's. Also, I'm not sure if there could be some situation where Python 2.7 is in use, but argparse isn't importable. This happened recently, for example, when a Tahoe-LAFS user reported that their Python 2.7 didn't have thesqlite
module. It wasn't entirely clear if this was the *BSD packaging of Python or some custom build of that user that had managed to omit this module from the Python standard library.In general, I prefer the approach of "try the most specific test that is accurate" over "determine the functionality from a version number", when practical.
That's a good consideration, too. In this case I currently prefer the above considerations, but I guess I could go either way.
It's Fedora 16.
I'm using my own spec to build tahoe-lafs rpm and some additional specs to build missing dependencies (including zfec). Specs does nothing more than
python setup.py build
andpython setup.py install
.It works pefectly on RHEL 5 & 6 (python 2.4 and 2.6), but does not works on Fedora 16.
Of course, I can port python-argparse (which presents on RHEL) to Fedora 16, but it will look ugly and I'm sure it's not necessary.
Yep, but it will break existing installs on all RHEL/CentOS/SL versions (not sure about status of 2.7 on other distros), and nobody really want to install 2.7 on such distro. Personally I think any wide-used project should support at least 2.4. I share you pain as a developer, but as a sysadmin I understand the reason why there are lots of users with older long-term support systems.
No, I did not. I've build zfec 1.4.22 just some days ago. And, oh, Thank you! I see you've just released a new version. I will try it.
It will help if tahoe-lafs will declare >= zfec-1.4.23 dependency on python 2.7. At least it will be clear from error message what needs to be upgraded.
Well, it not so easy: https://tahoe-lafs.org/trac/zfec/ticket/15
I've built it, but I don't want to install manually (as it will mess with system packaging) and don't want to use virtualenv (as I want tahoe & zfec installed system-wide).
What's the status of this ticket? Did the fact that I made a new release of zfec solve it and now it can be closed?
Or should we implement one of the suggestions from the comments, such as "It will help if tahoe-lafs will declare >= zfec-1.4.23 dependency" (from comment:88172)?
I still don't understand why the original
DistributionNotFound: argparse>=0.8
occurred, becausepython setup.py build
should have downloaded and built argparse, which should work absolutely fine on Python 2.7. Of course it might have failed to do so due to one of the numerous setuptools bugs (or some other network or packaging error), but we don't have enough information to tell which one.By the way, if the zfec requirement is bumped, it should be to >=1.4.24, not >=1.4.23 (due to https://tahoe-lafs.org/trac/zfec/ticket/15 ).
Okay, it sounds like our options are:
≥ 1.4.24
I vote for a).
Addendum: I propose to close this ticket because, as people upgrade to zfec ≥ 1.4.24 and as they upgrade to Python ≥ 2.7, this problem will stop happening. Also, since we don't understand exactly how it happened in the first place, it could have been something very specific to vrusinov's system, that won't affect other users.
vrusinov (or anyone else), please feel free to reopen this ticket if it happens again with any recent version of Tahoe-LAFS.