question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running on version 0.63 till 0.71 I get 'illegal instruction' error

See original GitHub issue

Summary

Running streamlit version 0.63 > 0.71 returns ‘illegal instruction’. I suspect this may be down to my architecture and most people have not seen this yet. Here is what I see even asking for version number:

(streamlit) elementary@elementary:~/virtualenv/streamlit/project/streamlit$ streamlit --version
Illegal instruction

Steps to reproduce

The steps I took to reproduce on a vanilla Ubuntu 18.04 LTS (elementary OS 5.0 Juno).

  1. sudo apt update
  2. sudo apt install software-properties-common
  3. sudo add-apt-repository ppa:deadsnakes/ppa
  4. sudo apt install python3.7
  5. sudo apt install python3-pip
  6. pip3 install virtualenv
  7. pip3 install virtualenvwrapper
  8. mkdir virtualenv
  9. 16 pwd
  10. nano .bashrc (Update bashrc for shortcuts)
  11. source ~/.bashrc
  12. mkvirtualenv streamlit --python=/usr/bin/python3.7
  13. cd virtualenv/streamlit/
  14. mkdir streamlit
  15. cd streamlit/
  16. pip install streamlit
  17. streamlit --version

(streamlit) elementary@elementary:~/virtualenv/streamlit/project/streamlit$ streamlit --version
Illegal instruction

This happens for all versions of streamlit between 0.63 to 0.71 For version 0.62 things start to work again.

Expected behavior:

I would expect from this command to see the version of streamlit displayed. So for me when I downgrade to 0.62 I see the following - which shows me uninstalling and installing version .62:

(streamlit) ~/virtualenv/streamlit/project/streamlit$ streamlit --version
Illegal instruction
(streamlit) :~/virtualenv/streamlit/project/streamlit$ pip uninstall streamlit
Found existing installation: streamlit 0.63.0
Uninstalling streamlit-0.63.0:
  Would remove:
    /home/elementary/virtualenv/streamlit/bin/streamlit
    /home/elementary/virtualenv/streamlit/bin/streamlit.cmd
    /home/elementary/virtualenv/streamlit/lib/python3.7/site-packages/streamlit-0.63.0.dist-info/*
    /home/elementary/virtualenv/streamlit/lib/python3.7/site-packages/streamlit/*
Proceed (y/n)? y
  Successfully uninstalled streamlit-0.63.0
(streamlit) elementary@elementary:~/virtualenv/streamlit/project/streamlit$ pip install streamlit==0.62.0
Collecting streamlit==0.62.0
.....
.....
.....
Installing collected packages: streamlit
Successfully installed streamlit-0.62.0
WARNING: You are using pip version 20.2.4; however, version 20.3 is available.
You should consider upgrading via the '/home/elementary/virtualenv/streamlit/bin/python -m pip install --upgrade pip' command.
(streamlit) ~/virtualenv/streamlit/project/streamlit$ streamlit --version
Streamlit, version 0.62.0

Actual behavior:

This is a show stopper. Nothing works! I tried:

  • streamlit --version
  • streamlit hello
  • streamlit run hello.py
(streamlit) elementary@elementary:~/virtualenv/streamlit/project/streamlit$ streamlit hello
Illegal instruction

Is this a regression?

Yes things worked in the past! 😦 …

Debug info

Streamlit version

(streamlit) elementary@elementary:~/virtualenv/streamlit/project/streamlit$ pip freeze
altair==4.1.0
argon2-cffi==20.1.0
astor==0.8.1
async-generator==1.10
attrs==20.3.0
backcall==0.2.0
base58==2.0.1
bleach==3.2.1
blinker==1.4
boto3==1.16.25
botocore==1.19.25
cachetools==4.1.1
certifi==2020.11.8
cffi==1.14.4
chardet==3.0.4
click==7.1.2
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
enum-compat==0.0.3
gitdb==4.0.5
GitPython==3.1.11
idna==2.10
importlib-metadata==3.1.0
ipykernel==5.3.4
ipython==7.19.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.17.2
Jinja2==2.11.2
jmespath==0.10.0
jsonschema==3.2.0
jupyter-client==6.1.7
jupyter-core==4.7.0
jupyterlab-pygments==0.1.2
MarkupSafe==1.1.1
mistune==0.8.4
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.0.8
nest-asyncio==1.4.3
notebook==6.1.5
numpy==1.19.4
packaging==20.7
pandas==1.1.4
pandocfilters==1.4.3
parso==0.7.1
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.0.1
prometheus-client==0.9.0
prompt-toolkit==3.0.8
protobuf==3.14.0
ptyprocess==0.6.0
pyarrow==2.0.0
pycparser==2.20
pydeck==0.5.0
Pygments==2.7.2
pyparsing==2.4.7
pyrsistent==0.17.3
python-dateutil==2.8.1
pytz==2020.4
pyzmq==20.0.0
requests==2.25.0
s3transfer==0.3.3
Send2Trash==1.5.0
six==1.15.0
smmap==3.0.4
streamlit==0.63.0
terminado==0.9.1
testpath==0.4.4
toml==0.10.2
toolz==0.11.1
tornado==5.1.1
traitlets==5.0.5
tzlocal==2.1
urllib3==1.26.2
validators==0.18.1
watchdog==0.10.4
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
zipp==3.4.0

Python version

(streamlit) elementary@elementary:~/virtualenv/streamlit/project/streamlit$ python --version
Python 3.7.9
(streamlit) elementary@elementary:~/virtualenv/streamlit/project/streamlit$ python
Python 3.7.9 (default, Aug 18 2020, 06:22:45) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Using virtualenv and virtualenvwrapper

OS version

OS-elementary

architecture

Additional information

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
kmcgradycommented, Dec 2, 2020

Hi @nherriot

First of all, thank you very much for bringing this up both on GitHub and in the Discuss Forum, and sorry we didn’t get back sooner! I hope that we figure out a solution here. We have been unable to repro on our systems (both macOS and Ubuntu), so this will be a little tricky to identify the solution.

“Illegal Instruction” errors occur when you try to run a program that was compiled with some processor-specific optimizations, and is then running on a processor that fails to meet those requirements. This leads me to think that something we introduced either wasn’t compiled correctly for your processor or something strange happened on your system when combined with our changes caused issues.

Here are a few ideas to try:

  1. (From a colleague) The AMD Phenom processor is not a unique processor, just an AMD64-compatible CPU, so it should be using the same Python binaries as all AMD and Intel CPUs from the past 15 or so years.That said, it may be worth a try having them build their own Python by using pyenv , since it looks like they’re installing theirs from a PPA (which I don’t trust 100%…). Also the PPA is for Ubuntu and their system is Elementary —which is based on Ubuntu, but may have some different libraries, which could be causing issues.
# Install pyenv
$ curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash# Install Python 3.7
$ ~/.pyenv/bin/pyenv install 3.7.0# Then point to the newly installed Python when creating the virtual env
$ mkvirtualenv streamlit --python=~/.pyenv/versions/3.7.0/bin/python

From then on, all pip packages are actually compiled on the users’ machine so they should all work fine.

  1. As @randyzwitch pointed out, the marked change between 0.62 and 0.63 is the introduction of a new package called pyarrow. It’s possible (but perhaps a little shocking) that it caused the problem. We don’t import arrow when you run streamlit --version, so that shouldn’t crash. But in any case, you can try to install pyarrow from Conda and see if that fixes it. It’s a long shot, but worth a try.

  2. With regard to (2) I see this: https://issues.apache.org/jira/browse/ARROW-4272 for pyarrow, and it might be related to a tensorflow installation. It might be worthwhile to test TensorFlow similarly. Here’s an article that shares more on how tensorflow can be a problem and call the Illegal Instruction https://tech.amikelive.com/node-887/how-to-resolve-error-illegal-instruction-core-dumped-when-running-import-tensorflow-in-a-python-program/

All these ideas are educated guesses that I hope either yield fruitful results or at least more information to solve the problem. Let us know what you end up figuring out.

1reaction
nherriotcommented, Jan 19, 2021

Hi Streamlit,

just to let you all know. By using pyenv to compile python for my particular server the issue was fixed. Just to note for anyone else who may be following this and has a similar problem if you see this type of thing after using pyenv to install python and setting up streamlit in your virtual environment:


   ~/virtualenv/streamlit_pyenv/project/streamlit$ streamlit --version
      Traceback (most recent call last):
  File "/home/nherriot/virtualenv/streamlit_pyenv/bin/streamlit", line 5, in <module>
    from streamlit.cli import main
...
...
...
   File "/home/nherriot/.pyenv/versions/3.7.0/lib/python3.7/bz2.py", line 19, in <module>
        from _bz2 import BZ2Compressor, BZ2Decompressor
   ModuleNotFoundError: No module named '_bz2'

I believe it means you have no ‘C’ header files installed for that application. You may see this type of warning when using pyenv to compile python for your system:


nherriot@kieran:~$ ~/.pyenv/bin/pyenv install 3.7.0
Downloading Python-3.7.0.tar.xz...
-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
Installing Python-3.7.0...
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
Installed Python-3.7.0 to /home/nherriot/.pyenv/versions/3.7.0

The safest way I found to fix is:

  1. Delete your ~/.pyenv folder
  2. Remove your virtualenv for that project
  3. Install the missing libraries e.g. for me /> sudo apt-get install libbz2-dev
  4. Install python with pyenv as expalined in the post from @kmcgrady
  5. Setup your virtual environement and point it to the newly install python library

Hope this helps someone in the future! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Illegal instruction - Using Streamlit
Summary Running streamlit version 0.63 > 0.71 returns 'illegal instruction'. I suspect this may be down to my architecture and most people have....
Read more >
I keep getting Illegal Instruction errors. What do I do?
Illegal Instruction errors occur when you try to run a program that was compiled with some processor-specific optimizations, ...
Read more >
I get the illegal instruction error while running Matlab code on ...
I am trying to run a Matlab code using a slurm file on a HPC. While running the code I'm getting the following...
Read more >
Fixing illegal instruction issues - ParabolaWiki
Sometimes, running a program results in a crash, and a message about illegal instruction(s). Here's an example from the bug report #2789:
Read more >
Illegal instruction(core dumped) error on Jetson Nano
Generally speaking, an "illegal instruction" error tends to happen when attempting to run something compiled for 1 CPU architecture on a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found