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

ValueError: Not a valid python version #3241

Closed
Mortuie opened this issue Nov 16, 2018 · 6 comments
Closed

ValueError: Not a valid python version #3241

Mortuie opened this issue Nov 16, 2018 · 6 comments
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue.

Comments

@Mortuie
Copy link

Mortuie commented Nov 16, 2018

AVOID POSTING ISSUES UNDER THIS CATEGORY.

If Pipenv is not functioning as you would like it to, consider filing either a bug report, or a feature request instead.

Please refer to StackOverflow tag for more information.


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

If you're on macOS, run the following:

$ pipenv --support | pbcopy

If you're on Windows, run the following:

> pipenv --support | clip

If you're on Linux, run the following:

$ pipenv --support | xclip

Well I can't even run pipenv --support it gives me this error

   return f(get_current_context(), *args, **kwargs)
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/cli/command.py", line 142, in cli                                                                                
    get_pipenv_diagnostics()
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/help.py", line 33, in get_pipenv_diagnostics                                                                     
    python_paths = finder.find_all_python_versions()
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 136, in find_all_python_versions                                      
    major=major, minor=minor, patch=patch, pre=pre, dev=dev, arch=arch, name=name
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 328, in find_all_python_versions                                       
    values = list(self.get_pythons(sub_finder))
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 279, in get_pythons                                                    
    reverse=True
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 277, in <genexpr>                                                      
    (p for p in self._filter_paths(finder) if p.is_python),
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 264, in <genexpr>                                                      
    pth for pth in unnest(finder(p) for p in self.path_entries if p is not None)
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/utils.py", line 138, in unnest                                                               
    for el in target:
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 264, in <genexpr>                                                      
    pth for pth in unnest(finder(p) for p in self.path_entries if p is not None)
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/mixins.py", line 76, in find_all_python_versions                                      
    path_filter = filter(None, (sub_finder(p) for p in self.children.values()))
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/cached_property.py", line 35, in __get__                                                                  
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 494, in children                                                       
    for child_key, child_val in self._gen_children():
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 487, in _gen_children                                                  
    yield (child.as_posix(), PathEntry.create(path=child, **pass_args))
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 567, in create                                                         
    _new = cls(**creation_args)
  File "<attrs generated init 1a0d15d2d89843b0eea5f1da4750a4c34f8387c7>", line 16, in __init__
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 510, in get_py_version                                                 
    py_version = PythonVersion.from_path(path=self, name=self.name)
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 418, in from_path                                                    
    instance_dict = cls.parse(py_version.strip())
  File "/home/leon/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 366, in parse                                                        
    raise ValueError("Not a valid python version: %r" % version)
ValueError: Not a valid python version: <LegacyVersion('2.7.15+')>

I'm using pyenv and pipenv and they don't seem to be playing nice, anyone seen an error like this before ?

@duplicate-issues
Copy link

Hey @Mortuie,

We did a quick check and this issue looks very darn similar to

This could be a coincidence, but if any of these issues solves your problem then I did a good job 😄

If not, the maintainers will get to this issue shortly.

Cheers,
Your Friendly Neighborhood ProBot

@frostming frostming added the Type: Duplicate This issue is a duplicate of an already-existing issue. label Nov 16, 2018
@frostming
Copy link
Contributor

Similar and potential duplicated issues:

#3208
#3232

BTW, the bot seems to give nothing but 3 most recent issues.

@Mortuie
Copy link
Author

Mortuie commented Nov 16, 2018

@frostming I have installed on linux using the update-vendor branch and it doesn't fix the error, the error still persists...

@mystor
Copy link

mystor commented Nov 18, 2018

Running into the same issue here (Ubuntu 18.10), so I did a quick poke-around with pdb.

It seems as though the /usr/bin/python2.7 binary on 18.10 has made the odd decision to report its version as '2.7.15+'. This trips up the vendored packaging module's version.parse method, generating a LegacyVersion, as it is not expecting a + character.

The invalid version string then causes an exception to be raised by pythonfinder, which kills the pipenv process.

This feels to me like a mistake made while packaging this version of python2.7 in Ubuntu 18.10, but it might make sense to add a workaround for it in pipenv either way, as Ubuntu is a fairly popular distro.

I'm guessing the "correct" thing to do here would be for pythonfinder to not throw an error in this situation, instead ignoring the oddly-versioned python executable, but that might be a bad experience for Ubuntu users due to the broken version string, so it might also make sense to add a special-case.

@techalchemy
Copy link
Member

We understand the issue in full, it's being tracked in pythonfinder already -- sorry for the trouble and thanks for the report

@techalchemy
Copy link
Member

This was fixed in #3254 -- sorry for the trouble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue.
Projects
None yet
Development

No branches or pull requests

4 participants