question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[REQUEST] Make it work within a virtualenv

See original GitHub issue

Is your feature request related to a problem? Please describe. I tried to install this in a virtualenv, like I install Python packages in general. I could, but it crashed with an error:

Traceback (most recent call last):
  File "/home/faassen/.virtualenvs/pytools3/bin/bpytop", line 5, in <module>
    from bpytop import main
  File "/home/faassen/.virtualenvs/pytools3/lib/python3.8/site-packages/bpytop.py", line 205, in <module>
    for td in site.getsitepackages() + [site.getusersitepackages()]:
AttributeError: module 'site' has no attribute 'getsitepackages'

The reason is because virtualenv don’t (and I think cannot) support getsitepackages:

https://github.com/pypa/virtualenv/issues/737

Describe the solution you’d like

I would like bpytop to work in a virtualenv. From the code it looks like the sitepackages are consulted to figure out to load up some kind of theme. Perhaps using a setuptools entry point would be a more compatible way to pick up theme packages that doesn’t require this low level access?

https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins

Describe alternatives you’ve considered

I considered installing it in my system Python directly but I try to keep this clean of custom installations as much as possible.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
aristocratoscommented, Sep 7, 2020

That seems to be working. Will be in next update.

0reactions
aristocratoscommented, Sep 7, 2020

@faassen Should be fixed in v1.0.26

Reopen this otherwise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

venv — Creation of virtual environments
Running this command creates the target directory (creating any parent directories that don't exist already) and places a pyvenv.cfg file in it with...
Read more >
How can I use a requests module within virtual environment?
I installed requests module within that virtual environment and while trying to import that module I got the following exception:
Read more >
Python Virtual Environments: A Primer
In this tutorial, you'll learn how to work with Python's venv module to create and manage separate virtual environments for your Python ...
Read more >
Virtualenv and venv: Python virtual environments explained
To install virtualenv, just use pip install virtualenv . To create a virtual environment directory with it, type virtualenv /path/to/directory .
Read more >
Virtual environments for absolute beginners — what is it ...
2.3 Creating our first virtual environment · Navigate to the folder where you want to create your project. We'll call this the root...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found