SystemError: initialization of _heapq did not return an extension module
See original GitHub issueI’m experiencing the same error mentioned by @sirgogo in #88 .
oliver@oliver-arch:~ % ipython
Python 3.5.5 |Anaconda, Inc.| (default, Mar 12 2018, 23:12:44)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import julia
In [2]: j = julia.Julia()
Error processing line 1 of /home/oliver/local/miniconda3/lib/python3.5/site-packages/PyUtilib-5.4.1-py2.7-nspkg.pth:
Failed to import the site module
Traceback (most recent call last):
File "/home/oliver/local/miniconda3/lib/python3.5/site.py", line 167, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "/home/oliver/local/miniconda3/lib/python3.5/types.py", line 166, in <module>
import functools as _functools
File "/home/oliver/local/miniconda3/lib/python3.5/functools.py", line 21, in <module>
from collections import namedtuple
File "/home/oliver/local/miniconda3/lib/python3.5/collections/__init__.py", line 29, in <module>
import heapq as _heapq
File "/home/oliver/local/miniconda3/lib/python3.5/heapq.py", line 587, in <module>
from _heapq import *
SystemError: initialization of _heapq did not return an extension module
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/oliver/local/miniconda3/lib/python3.5/site.py", line 559, in <module>
main()
File "/home/oliver/local/miniconda3/lib/python3.5/site.py", line 541, in main
known_paths = addsitepackages(known_paths)
File "/home/oliver/local/miniconda3/lib/python3.5/site.py", line 318, in addsitepackages
addsitedir(sitedir, known_paths)
File "/home/oliver/local/miniconda3/lib/python3.5/site.py", line 206, in addsitedir
addpackage(sitedir, name, known_paths)
File "/home/oliver/local/miniconda3/lib/python3.5/site.py", line 177, in addpackage
import traceback
File "/home/oliver/local/miniconda3/lib/python3.5/traceback.py", line 3, in <module>
import collections
File "/home/oliver/local/miniconda3/lib/python3.5/collections/__init__.py", line 29, in <module>
import heapq as _heapq
File "/home/oliver/local/miniconda3/lib/python3.5/heapq.py", line 587, in <module>
from _heapq import *
SystemError: initialization of _heapq did not return an extension module
I’m running Arch Linux and using the following versions:
Package | Version |
---|---|
python | 3.5.5 :: Anaconda, Inc. |
julia | 0.6.2 |
PyJulia | 0.1.5 |
PyCall | 1.15.0 |
Any advice is appreciated!
Thanks, Oliver
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Python crash when boost/c++ is imported if anaconda was used
It turns out the error isn't specifically with Py_Initialize() , but with the symbolic linkage between program and python runtime.
Read more >initialization of _heapq did not return an extension module
I'm experiencing the same error mentioned by @sirgogo in #88 . oliver@oliver-arch:~ % ipython Python 3.5.5 |Anaconda, Inc.| (default, ...
Read more >Python crash when boost/c++ is imported if anaconda was used
SystemError : initialization of _heapq did not return an extension module. Sys/build details: Mac OS Mojave, 10.14.6 Python version 3.7.4, Conda 4.8.3 C++...
Read more >heapq — Heap queue algorithm — Python 3.11.1 ...
Source code: Lib/heapq.py This module provides an implementation of the heap ... as a regular Python list without surprises: heap[0] is the smallest...
Read more >Efficiency for calling Julia from python and purely run Julia
python3.8/heapq.py", line 581, in <module> from _heapq import * SystemError: initialization of _heapq did not return an extension module.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have a similar issue on my conda python, but not the homebrew python.
It may be because JuliaCall fails to detect if (anaconda/miniconda) python has been initialized.
I got the following from my miniconda python
I got the following from my homebrew python
UPDATE:
The following code works in miniconda python
And it seems that PyCall already loads in process symbols https://github.com/JuliaPy/PyCall.jl/pull/293 Not sure the reason now.
Removing
~/.julia/lib/v0.6/PyCall.jl
worked for me. System info below:OS: Ubuntu 16.04 (running inside a Docker container) Julia: 0.6 Python: 3.5.2 Virtual Environment: Conda (rllab, https://github.com/rll/rllab/blob/master/environment.yml)