Command not found

i don’t know where is the problem i have been installed streamlit succesfully.
Screenshot%20from%202019-10-25%2008-36-18|690x456

Hey @Cellule_Boukham :wave:,

If I’m reading your screenshot correctly, this looks like a Python environment issue, where for some reason the streamlit executable is not in your $PATH. Can you post a few pieces of data to help debug?

  1. How exactly did you install Streamlit?

    • pip install streamlit
    • pip3 install streamlit
    • sudo pip install streamlit
    • pip install streamlit --user
    • Something else?
  2. Can you post the output of these commands?

    $ echo $PATH
    $ which python
    $ which streamlit
  1. What do you get when you try this:
    $ python    # (or python3 if you used pip3)
    >>> import streamlit
    >>> streamlit.__file__
1 Like

Hi, I have the same issue, I’ll be glad for any advice. I’m using conda for env managment. To answer your questions above:

  1. I’ve installed it using pip3 (however I tried using pip before)
  2. echo $PATH
    /home/eliska/anaconda3/envs/deepnet-2-gpu-gui/bin:/home/eliska/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

$ which python
/home/eliska/anaconda3/envs/deepnet-2-gpu-gui/bin/python

$ which streamlit
(nothing)

  1. returns:
    ‘/home/eliska/.local/lib/python3.6/site-packages/streamlit/init.py’

Hi @emal

From the data you posted, my guess is that when you pip-installed Streamlit you weren’t inside your Conda environment. I say this because your Streamlit was installed in ~/.local/lib/... rather than in ~/anaconda3/envs/....

So try this:

# Remove Streamlit from your local Python installation.
conda deactivate
pip uninstall streamlit

# Activate the Conda environment and install Streamlit.
conda activate envName  # Replace with the name of your environment
pip install streamlit
2 Likes

Hi, thanks for the effort @thiago. That would be a logical assumption. However, when installing streamlit I was already in the environment, that’s why I’m not sure why it gets installed outside. But after your comment, at least I know it should work this way, so I’ll try to fix it somehow.

Hi thiago, I have the same issue, I’ll be glad for any advice. I’m using Python 3.7. To answer your questions above:
1 I’ve installed it using " pip install streamlit "
2 echo $PATH
/media/felipe/SAMSUNG/LAPTOP RECENTE/felipe/Python3.7/Semana de Data Science/aula03/aula03

               which python:
               /home/felipe/miniconda3/bin/python

                which streamlit
                (NOTHING)

          3.returns
            Python 3.7.1 (default, Dec 14 2018, 19:28:38) 

[GCC 7.3.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import streamlit
streamlit.file
‘/home/felipe/.local/lib/python3.7/site-packages/streamlit/init.py’

That’s it. As I see, I managed to install streamlit both in my /home address and in the $PATH written above, but unfortunately the “streamlit” command has not been found. How can I solve this problem?

Experienced the same problem. I got it to work by adding

export PATH="$HOME/.local/bin:$PATH"

to my .zprofile

6 Likes

@Roberto this solve my same issue, but temporarily means once I close the terminal, after reopen I need to do the same. Can U plz explain in detail how to get a permanent solution. Thanks

1 Like

Oh right source /.zprofile after adding the export line

1 Like

Thanks but not working. :frowning_face:

1 Like

Thank you!! This worked

Nevermind… this was not the right thing to do. This gave me even more issues, I had to fix with someone more knowledgable than myself later on… Do not follow this advice!!!

Hey I had the same issue. If you are using Visual Studio Code, try switching your interpreter. pathfix

1 Like

It also worked here for me. Thank you!

1 Like

Have you try manually activating your env:
source .venv/bin/activate

and then
pip install streamlit

I am using miniconda3 and I am on the base environment. These are the steps that worked for me after installing streamlit using pip (I am using a Mac):

cd ~
ls -la
vim .bash_profile

At this point you are in the vim mode to edit the file you need to click the letter i to go into “insert mode”

Then, add export PATH=“$HOME/.local/bin:$PATH” to the bash profile, in my case I added it in the inner else statement of the conda initialize block, it should look like something like this:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup= blablabla
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if  blablabla
    else
        export PATH="$HOME/.local/bin:$PATH"
        #export PATH="/Users/oda/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

Once you copy the path you need to hit ESC and :wq! to write and quit the bash_profile (save and safely exit the file)
then you can do:

streamlit hello

and you should get a “Welcome to Streamlit” message.

I hope this helps.