pigar cannot find the package name
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.
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.
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 <[email protected]>
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/
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.