Package not found using os.system()

Hello,
I installed “tabulate” through requirements.txt and I check that by:

import streamlit as st
import pkg_resources

installed_packages = pkg_resources.working_set

for package in installed_packages:
    st.write(package.key, package.version)
## tabulate 0.9.0 was found.

But when in my running app.py:

python_path    = subprocess.run(["which", "python"], stdout=subprocess.PIPE, text=True).stdout.strip()
os.system(python_path   + "f1.py")

something wrong:

ModuleNotFoundError: No module named 'tabulate'

in f1.py:

from tabulate import tabulate

Best,

You are probably using different python environments.

thanks !!!
python_path = sys.executable
solve the problem !!!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.