Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Invalid version number error with Python

📅 2017-Feb-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ error, python, version ⬩ 📚 Archive


I tried to import a Python package that I had installed from source. The import failed with this error:

File "/usr/lib/python2.7/distutils/", line 40, in __init__
File "/usr/lib/python2.7/distutils/", line 107, in parse
  raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '2.7.0rc3'


It turns out that package version number has to be in the x.y.z format. Else Python throws this error.

Since I had the source code of this package, I found all instances of 2.7.0rc3 and changed it to 2.7.0. Typically, this will be in the and files. I removed the previously installed package and reinstalled this changed source code. I was able to import after this successfully.

Tried with: Ubuntu 14.04