exaloop / codon

A high-performance, zero-overhead, extensible Python compiler using LLVM
https://docs.exaloop.io/codon
Other
15.15k stars 520 forks source link

codon-jit: No module named "codon" #348

Closed matroscoe closed 5 days ago

matroscoe commented 1 year ago

was hoping someone could help out with the following error:

codon.codon_jit.JITError: /home/ubuntu/.pyenv/versions/3.11.1/envs/<venv>/lib/python3.11/site-packages/<internal-package>/file.py:19:2: no module named 'codon' 

I am using pycharm and in the editor it is not throwing any errors and codon-jit is in the venv I can find codon/ and codon_jit-0.1.3.dist-info the issue only pops up when I try to kick off the python script importing our internal package which is developed and deployed with the codon-jit package listed as a dependency.

yincangshiwei commented 1 year ago

I have the same situation, have you resolved it?

matroscoe commented 1 year ago

@yincangshiwei no and I reached out both here and on the codon slack and got nothing in response so I don't know what to do about it.

arshajii commented 1 year ago

Apologies for the delay. Let us look into this and follow up ASAP.

inumanag commented 1 year ago

Apologies for the delay—this one went under my radar.

I am not able to reproduce this issue. Can you please describe your setup/environment?Are you using any venv or Conda? Also, when does this happen: are you using codon.jit directly, indirectly etc?

Most importantly: try setting export CODON_PATH=<path_to_codon> (usually $HOME/.codon) and running it again.

pouyehbnj commented 7 months ago

I have the same issue. I'm using venv and codon-jit is installed there and I set CODON_PATH accordingly as well. I get the error :no module named 'codon' . I tried it on a simple code from the documentation for prime number calculation and it did not work. However, codon itself works and I can access libraries using from python import . Is there any solution for this?

future commented 2 months ago

I also encountered the same problem, My environment is using Anaconda, Python 3.11.7 Environment variables have been set export CODON_DIR=/root/.codon export CODON_PATH=/root/.codon The following error message still appears

Traceback (most recent call last):
 File "/root/workspace/sparkimpulse/codon_example/inpython.py", line 4, in <module>
 import codon
 File "/root/anaconda3/lib/python3.11/site-packages/codon/__init__.py", line 5, in <module>
 from .decorator import jit, convert, execute, JITError
 File "/root/anaconda3/lib/python3.11/site-packages/codon/decorator.py", line 17, in <module>
 from .codon_jit import JITWrapper, JITError, codon_library
ImportError: /root/anaconda3/lib/python3.11/site-packages/codon/codon_jit.cpython-311-x86_64-linux-gnu.so: undefined symbol: _ZN5codon3jit7jitInitERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
inumanag commented 5 days ago

Duplicate of #123, moving the discussion there. Thank you all for these reports.