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

pigar cannot find the package name #221

Open
ManiAm opened this issue Sep 12, 2024 · 3 comments
Open

pigar cannot find the package name #221

ManiAm opened this issue Sep 12, 2024 · 3 comments
Labels

Comments

@ManiAm
Copy link

ManiAm commented Sep 12, 2024

I have this import in one of the files,

try:
    from bs4 import BeautifulSoup
    bs4_support = True
except:
    bs4_support = False

Invoke pigar with:

pigar generate --auto-select --question-answer no

However it cannot find the package name 'beautifulsoup4'.

Same is true for,

try:
    import jinja2
    jinja_support = True
except ImportError:
    jinja_support = False

I am using rhel 8.9 and python 3.12.0.

@damnever
Copy link
Owner

try:
  import bs4
except ImportError:
  ...

this makes pigar consider bs4 as optional, pigar will simply ignore it if it is not installed in the local environment. This behavior might be disabled via an additional option, but I don't have strong opinions on this.

If you want to resolve this, you can either remove the try ... except ImportError ... block or install bs4 in the local environment manually.

@ManiAm
Copy link
Author

ManiAm commented Sep 12, 2024

or install bs4 in the local environment manually.

beautifulsoup4 is installed on my local virtual env.

pip3 show beautifulsoup4
Name: beautifulsoup4
Version: 4.12.3
Summary: Screen-scraping library
Home-page: https://www.crummy.com/software/BeautifulSoup/bs4/
Author: 
Author-email: Leonard Richardson <leonardr@segfault.org>
License: MIT License
Location: /auto/panini-projs/fabric/spitfire/CATS/python3.12/lib/python3.12/site-packages
Requires: soupsieve
Required-by: nbconvert

Link:
https://pypi.org/project/beautifulsoup4/

@damnever
Copy link
Owner

The current limitation is that both need to be in the same Python environment, whether it's the system global environment or a virtual one.

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

No branches or pull requests

2 participants