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.

pytest fails with 'terminated by signal SIGILL (Illegal instruction)'

See original GitHub issue

Calling pytest from a pipenv raises 'pipenv run pytest' terminated by signal SIGILL (Illegal instruction) when $SHELL is fish 2.7.1 and Illegal instruction: 4 when $SHELL is bash 3.2.

I have opened an issue here because the same version of pytest installed in a conda environment on the same machine executes as expected. I am trying to replicate my conda workflow using pipenv, so testing them side by side.

Please run $ python -m pipenv.help, and paste the results here.

I installed pipenv from homebrew so apparently this does not work.


Expected result

pytest runs my tests as it does in a conda env shown below:

pytest tests/                    
============================= test session starts ==============================
platform darwin -- Python 3.6.3, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: /foo, inifile:
plugins: xdist-1.20.1, forked-0.2, cov-2.5.1, hypothesis-3.38.5
collected 1 item

tests/test_pgdb.py .
Actual result

With $SHELL = /usr/local/bin/fish:

pipenv run pytest --collect-only --debug tests/test_pgdb.py
writing pytestdebug information to /foo/pytestdebug.log
============================= test session starts ==============================
platform darwin -- Python 3.6.4, pytest-3.3.1, py-1.5.2, pluggy-0.6.0 -- /Users/me/.local/share/virtualenvs/warehouse-nvT3qLa9/bin/python3.6
using: pytest-3.3.1 pylib-1.5.2
rootdir: /foo, inifile:
collecting 0 items                                                             
fish: 'pipenv run pytest --collect-onl…' terminated by signal SIGILL (Illegal instruction)

With $SHELL = /bin/bash:

pipenv shell
Spawning environment shell (/bin/bash). Use 'exit' to leave.
bash-3.2$ . /Users/me/.local/share/virtualenvs/warehouse-nvT3qLa9/bin/activate
(warehouse-nvT3qLa9) bash-3.2$ pytest tests/
============================= test session starts ==============================
platform darwin -- Python 3.6.4, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: /foo, inifile:
collecting 0 items                                                             
Illegal instruction: 4
Steps to replicate

pipenv 11.7.2, macOS 10.12.6, Mac Pro 5,1

  1. Uninstall pytest optional plugins in case they were at issue
  2. Either call pipenv shell and then call pytest tests/ or `pipenv run pytest tests/'. Results are identical.
Pipfile
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

sqlalchemy = "*"
"psycopg2" = "*"
arrow = "*"
"beautifulsoup4" = "*"
lxml = "*"
pandas = "*"
"pdfminer.six" = "*"
requests = "*"
requests-cache = "*"
selenium = "*"
xlrd = "*"


[dev-packages]

pylint = "*"
"e1839a8" = {path = ".", editable = true}
pytest = "==3.3.1"


[requires]

python_version = "3.6"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jtratnercommented, Mar 16, 2018

__pycache__ is not where it would be, it’d be in your pip and pipenv caches + in your virtualenv.

I.e. on OSX:

rm -fr ~/Library/Caches/pip
rm -fr ~/Libary/Caches/pipenv
pipenv --rm
0reactions
ralexxcommented, Mar 15, 2018

For posterity’s sake, installing psycopg2 from source fixed this problem. pipenv’s choice of wheel seems to have been deprecated by the package maintainer. Thanks @jtratner for leading me to the solution.

pipenv install https://pypi.python.org/packages/74/83/51580322ed0e82cba7ad8e0af590b8fb2cf11bd5aaa1ed872661bd36f462/psycopg2-2.7.4.tar.gz#md5=70fc57072e084565a42689d416cf2c5c
Installing https://pypi.python.org/packages/74/83/51580322ed0e82cba7ad8e0af590b8fb2cf11bd5aaa1ed872661bd36f462/psycopg2-2.7.4.tar.gz#md5=70fc57072e084565a42689d416cf2c5c…
Collecting https://pypi.python.org/packages/74/83/51580322ed0e82cba7ad8e0af590b8fb2cf11bd5aaa1ed872661bd36f462/psycopg2-2.7.4.tar.gz#md5=70fc57072e084565a42689d416cf2c5c
  Downloading psycopg2-2.7.4.tar.gz (425kB)
Building wheels for collected packages: psycopg2
  Running setup.py bdist_wheel for psycopg2: started
  Running setup.py bdist_wheel for psycopg2: finished with status 'done'
  Stored in directory: /Users/me/Library/Caches/pip/wheels/c7/47/65/1d83bcda24e50df551bcf41f9c7d5aba85064e555246f275c8
Successfully built psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2-2.7.4

Test fails as expected showing test data written to database and queried back.

source /Users/me/.local/share/virtualenvs/db-nvT3qLa9/bin/activate.fish
(db-nvT3qLa9) ⋊> /V/W/r/C/db on dev ⨯ pytest              14:10:02

============================= test session starts ==============================
platform darwin -- Python 3.6.4, pytest-3.4.2, py-1.5.2, pluggy-0.6.0
rootdir: /V/W/mytmp/simpleproj/db, inifile:
collected 2 items

tests/test_test.py .F                                                    [100%]

=================================== FAILURES ===================================
_________________________________ test_insert __________________________________

    def test_insert():
        """Write to database."""
        ins = pgdb.pginsert(pgdb.test_table).values(someval='bar')
        sel = pgdb.select(['*']).select_from(pgdb.test_table)

        conn = pgdb.pg_engine.connect()
        conn.execute(ins)
        query = conn.execute(sel).fetchall()
        print('query', query)
        conn.close()
>       assert 0
E       assert 0

tests/test_test.py:39: AssertionError
----------------------------- Captured stdout call -----------------------------
2018-03-15 14:12:13,059 INFO sqlalchemy.engine.base.Engine INSERT INTO test_table (someval) VALUES (%(someval)s) RETURNING test_table.indexnum
2018-03-15 14:12:13,059 INFO sqlalchemy.engine.base.Engine {'someval': 'bar'}
2018-03-15 14:12:13,060 INFO sqlalchemy.engine.base.Engine COMMIT
2018-03-15 14:12:13,061 INFO sqlalchemy.engine.base.Engine SELECT *
FROM test_table
2018-03-15 14:12:13,061 INFO sqlalchemy.engine.base.Engine {}
query [(1, 'bar'), (2, 'bar')]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python giving illegal instruction(core dumped) error when ...
import tensorflow [New Thread 0x7ffff29ec700 (LWP 1500)] Thread 1 "python" received signal SIGILL, Illegal instruction.
Read more >
How to Resolve The Error “Illegal instruction (core dumped ...
In brief, the error will be thrown if we're running recent TensorFlow binaries on CPU(s) that do not support Advanced Vector Extensions (AVX), ......
Read more >
signal — Set handlers for asynchronous events ... - Python Docs
Raised to signal an error from the underlying setitimer() or getitimer() implementation. Expect this error if an invalid interval timer or a negative...
Read more >
SIGILL: illegal instruction | Apple Developer Forums
As to what's causing that trap, it's hard to say without a backtrace. If you disable the Go signal handler than the system...
Read more >
Fixing "Illegal instruction 4 error in macOS terminal when ...
Hi, I am currently trying to install deep labcut on my macbook (has an M1 chip and is running on Big sur version...
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