ImportError: cannot import name 'Faker' from partially initialized module 'faker'

File "/Users/user/opt/anaconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)File "/Users/user/Documents/streamlit/faker.py", line 8, in <module>
    from faker import FakerFile "/Users/user/Documents/streamlit/faker.py", line 8, in <module>
    from faker import Faker

Any thoughts on how to pass installed packages?

environment.yml:

name: streamlit
channels:

  • conda-forge
  • defaults
    dependencies:
  • anyio=3.5.0=py39hecd8cb5_0
  • appnope=0.1.2=py39hecd8cb5_1001
  • argon2-cffi=21.3.0=pyhd3eb1b0_0
  • argon2-cffi-bindings=21.2.0=py39hca72f7f_0
  • asttokens=2.0.5=pyhd3eb1b0_0
  • backcall=0.2.0=pyhd3eb1b0_0
  • beautifulsoup4=4.11.1=py39hecd8cb5_0
  • bleach=4.1.0=pyhd3eb1b0_0
  • ca-certificates=2022.12.7=h033912b_0
  • certifi=2022.12.7=pyhd8ed1ab_0
  • cffi=1.15.1=py39h6c40b1e_3
  • comm=0.1.2=py39hecd8cb5_0
  • debugpy=1.5.1=py39he9d5cce_0
  • decorator=5.1.1=pyhd3eb1b0_0
  • defusedxml=0.7.1=pyhd3eb1b0_0
  • entrypoints=0.4=py39hecd8cb5_0
  • executing=0.8.3=pyhd3eb1b0_0
  • faker=17.6.0=pyhd8ed1ab_0
  • flit-core=3.6.0=pyhd3eb1b0_0
  • icu=58.2=h0a44026_3
  • idna=3.4=py39hecd8cb5_0
  • ipykernel=6.19.2=py39h01d92e1_0
  • ipython=8.10.0=py39hecd8cb5_0
  • ipython_genutils=0.2.0=pyhd3eb1b0_1
  • jedi=0.18.1=py39hecd8cb5_1
  • jinja2=3.1.2=py39hecd8cb5_0
  • jsonschema=4.17.3=py39hecd8cb5_0
  • jupyter_client=7.4.9=py39hecd8cb5_0
  • jupyter_core=5.2.0=py39hecd8cb5_0
  • jupyter_server=1.23.4=py39hecd8cb5_0
  • jupyterlab_pygments=0.1.2=py_0
  • libcxx=14.0.6=h9765a3e_0
  • libffi=3.4.2=hecd8cb5_6
  • libiconv=1.16=hca72f7f_2
  • libsodium=1.0.18=h1de35cc_0
  • libxml2=2.9.14=hbf8cd5e_0
  • libxslt=1.1.35=h5b33f42_0
  • lxml=4.9.1=py39h65b224f_0
  • matplotlib-inline=0.1.6=py39hecd8cb5_0
  • mistune=0.8.4=py39h9ed2024_1000
  • nbclassic=0.5.2=py39hecd8cb5_0
  • nbclient=0.5.13=py39hecd8cb5_0
  • nbconvert=6.5.4=py39hecd8cb5_0
  • nbformat=5.7.0=py39hecd8cb5_0
  • ncurses=6.4=hcec6c5f_0
  • nest-asyncio=1.5.6=py39hecd8cb5_0
  • notebook=6.5.2=py39hecd8cb5_0
  • notebook-shim=0.2.2=py39hecd8cb5_0
  • openssl=1.1.1t=hfd90126_0
  • pandocfilters=1.5.0=pyhd3eb1b0_0
  • parso=0.8.3=pyhd3eb1b0_0
  • pexpect=4.8.0=pyhd3eb1b0_3
  • pickleshare=0.7.5=pyhd3eb1b0_1003
  • pip=22.3.1=py39hecd8cb5_0
  • platformdirs=2.5.2=py39hecd8cb5_0
  • prometheus_client=0.14.1=py39hecd8cb5_0
  • prompt-toolkit=3.0.36=py39hecd8cb5_0
  • psutil=5.9.0=py39hca72f7f_0
  • ptyprocess=0.7.0=pyhd3eb1b0_2
  • pure_eval=0.2.2=pyhd3eb1b0_0
  • pycparser=2.21=pyhd3eb1b0_0
  • python=3.9.16=h218abb5_0
  • python-dateutil=2.8.2=pyhd3eb1b0_0
  • python-fastjsonschema=2.16.2=py39hecd8cb5_0
  • pyzmq=23.2.0=py39he9d5cce_0
  • readline=8.2=hca72f7f_0
  • send2trash=1.8.0=pyhd3eb1b0_1
  • setuptools=65.6.3=py39hecd8cb5_0
  • six=1.16.0=pyhd3eb1b0_1
  • sniffio=1.2.0=py39hecd8cb5_1
  • soupsieve=2.3.2.post1=py39hecd8cb5_0
  • sqlite=3.40.1=h880c91c_0
  • stack_data=0.2.0=pyhd3eb1b0_0
  • terminado=0.17.1=py39hecd8cb5_0
  • tinycss2=1.2.1=py39hecd8cb5_0
  • tk=8.6.12=h5d9f67b_0
  • tornado=6.2=py39hca72f7f_0
  • traitlets=5.7.1=py39hecd8cb5_0
  • typing_extensions=4.4.0=py39hecd8cb5_0
  • wcwidth=0.2.5=pyhd3eb1b0_0
  • webencodings=0.5.1=py39hecd8cb5_1
  • websocket-client=0.58.0=py39hecd8cb5_4
  • wheel=0.38.4=py39hecd8cb5_0
  • xz=5.2.10=h6c40b1e_1
  • zeromq=4.3.4=h23ab428_0
  • zlib=1.2.13=h4dc903c_0
  • pip:
    • altair==4.2.2
    • attrs==22.2.0
    • blinker==1.5
    • cachetools==5.3.0
    • charset-normalizer==3.0.1
    • click==8.1.3
    • gitdb==4.0.10
    • gitpython==3.1.31
    • importlib-metadata==6.0.0
    • markdown-it-py==2.2.0
    • markupsafe==2.1.2
    • mdurl==0.1.2
    • numpy==1.24.2
    • packaging==23.0
    • pandas==1.5.3
    • pillow==9.4.0
    • protobuf==3.20.3
    • pyarrow==11.0.0
    • pydeck==0.8.0
    • pygments==2.14.0
    • pympler==1.0.1
    • pyrsistent==0.19.3
    • pytz==2022.7.1
    • pytz-deprecation-shim==0.1.0.post0
    • requests==2.28.2
    • rich==13.3.1
    • semver==2.13.0
    • smmap==5.0.0
    • streamlit==1.19.0
    • toml==0.10.2
    • toolz==0.12.0
    • typing-extensions==4.5.0
    • tzdata==2022.7
    • tzlocal==4.2
    • urllib3==1.26.14
    • validators==0.20.0
    • zipp==3.14.0

Please share a link to your public github repo, so that we can see, which packages are really needed.
I would throw away this conda file and write a clean requirements.txt file.

https://github.com/yaser-najafi/streamlit.git

This repo does not exist or is private.

Oops. Should be public now.

You are importing module faker from a file called faker.py, I don’t think the interpreter is going to like that.

Also, delete the packages.txt file and add a requirements.txt file with the pip packages you need.

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