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

list command fails with FileNotFoundError (package_info.json) #124

Open
jitakirin opened this issue Jan 17, 2018 · 7 comments
Open

list command fails with FileNotFoundError (package_info.json) #124

jitakirin opened this issue Jan 17, 2018 · 7 comments

Comments

@jitakirin
Copy link
Contributor

Looks like Repo.list_everything calls Repo.get_package_info which tries to unconditionally open a package_info.json from each package's virtualenv. It fails as get-pipsi.py doesn't create this file for pipsi itself.

bash-4.4# curl -fsSL https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src='git+https://github.com/mitsuhiko/pipsi.git#egg=pipsi'
Installing pipsi
Collecting pipsi from git+https://github.com/mitsuhiko/pipsi.git#egg=pipsi
  Cloning https://github.com/mitsuhiko/pipsi.git to /tmp/pip-build-t34za7mg/pipsi
Collecting Click (from pipsi)
  Using cached click-6.7-py2.py3-none-any.whl
Collecting virtualenv (from pipsi)
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Installing collected packages: Click, virtualenv, pipsi
  Running setup.py install for pipsi ... done
Successfully installed Click-6.7 pipsi-0.10.dev0 virtualenv-15.1.0
Installed pipsi binary in /root/.local/bin
pipsi is now installed.
bash-4.4# 
bash-4.4# 
bash-4.4# pipsi list
Traceback (most recent call last):
  File "/root/.local/bin/pipsi", line 11, in <module>
    load_entry_point('pipsi==0.10.dev0', 'console_scripts', 'pipsi')()
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/pipsi/__init__.py", line 460, in list_cmd
    for venv, scripts in repo.list_everything()
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/pipsi/__init__.py", line 360, in list_everything
    info = self.get_package_info(venv_path)
  File "/root/.local/venvs/pipsi/lib64/python3.6/site-packages/pipsi/__init__.py", line 249, in get_package_info
    with open(package_info_file_path, 'r') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/root/.local/venvs/pipsi/package_info.json'
@dgrant
Copy link

dgrant commented Feb 18, 2018

Having this issue as well.

@jacobian
Copy link

I worked around this by creating ~/.local/vens/pipsi/package_info.json containing {"name": "pipsi", "version": "0.10.dev", "scripts": ["/Users/jacobkaplan-moss/.local/bin/pipsi"]}.

@idchlife
Copy link

pipsi list gives same error :(

@danyeaw
Copy link

danyeaw commented Feb 24, 2018

@jacobian Thanks for the tip, and the article about how you setup your dev environment. There is one typo is what you have above, it should say ~/.local/venvs. So I think what you want is:

echo '{"name": "pipsi", "version": "0.10.dev", "scripts": ["~/.local/bin/pipsi"]}' >> ~/.local/venvs/pipsi/package_info.json

Does #120 fix this as well?

@jacobian
Copy link

There is one typo is what you have above, it should say ~/.local/venvs.

Ah yes, nice catch - thanks.

Does #120 fix this as well?

It appears to, yes.

@icemac
Copy link

icemac commented Apr 26, 2018

This issue seems to be resolved, should it be closed?

@reorx
Copy link
Contributor

reorx commented Jun 25, 2018

This issue is not fixed, by running:

curl -fsSL https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python - --src='git+https://github.com/mitsuhiko/pipsi.git#egg=pipsi'
pipsi list

the file not found error can still be reproduced, I'll submit a pull request to fix it soon.

No offense here, but it's the lack of code quality, backward compatibility, testing coverage of this PR #78 caused all the issues relates to package_info.json. The current stable release of pipsi on pypi is 0.9 (it's worth mentioning it was released 3 years ago), which works well by just walking down venv directories to find executables. #78 broke the workflow, it involved a new data file, but didn't handle the exceptions and condition checking well. I'm planning to do a thoroughly check around the code about package_info.json, and fix everything to make sure it won't break anything when working with old venvs, or any other conditions in the future.

BTW I was just about to install roamer to complete a batch renaming task, then the problem occurred, then 1 hour of digging and investigating passed away…

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

No branches or pull requests

7 participants