Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Segfault when importing numpy on Mojo 0.4.1 #1726

Closed
jcoombes opened this issue Feb 3, 2024 · 2 comments
Closed

[BUG]: Segfault when importing numpy on Mojo 0.4.1 #1726

jcoombes opened this issue Feb 3, 2024 · 2 comments
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label

Comments

@jcoombes
Copy link

jcoombes commented Feb 3, 2024

Bug description

Running a code example from the docs causes a segfault.

Steps to reproduce

  • Include relevant code snippet or link to code that did not work as expected.

The code snippet here: https://docs.modular.com/mojo/manual/python/#import-a-python-module

from python import Python

fn main() raises:
    # This is equivalent to Python's `import numpy as np`
    let np = Python.import_module("numpy")

    # Now use numpy as if writing in Python
    let array = np.array([1, 2, 3])
    print(array)
  • If applicable, add screenshots to help explain the problem.
    image

  • Include anything else that might help us debug the issue.

(obvs) ➜ obvs git:(main) ✗ mojo obvs/gputest.🔥
[46656:46656:20240203,185804.294909:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[46656:46656:20240203,185804.295156:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo obvs/gputest.\360\237\224\245
#0 0x0000564ef39101b7 (/home/user/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x6211b7)
#1 0x0000564ef390dd8e (/home/user/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x61ed8e)
#2 0x0000564ef391088f (/home/user/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x62188f)
#3 0x00007fc6d2842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
[1] 46654 segmentation fault (core dumped) mojo obvs/gputest.🔥

System information

- What OS did you do install Mojo on ?
Ubuntu 22.04
pyenv+virtualenv setup as https://github.com/CoefficientSystems/modern-data-cookiecutter
following something like:
https://dev.to/alysivji/ultimate-solution-to-python-virtual-environments-pyenv--virtualenvwrapper

python --version
Python 3.11.7

python -c "import numpy; print(numpy.array([1, 2, 3]))"
[1 2 3]

this isn't an issue with numpy imports within python.

- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 0.7.0 (af002202)

- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.4.1 (2d8afe15)
@jcoombes jcoombes added bug Something isn't working mojo Issues that are related to mojo labels Feb 3, 2024
@jcoombes
Copy link
Author

jcoombes commented Feb 3, 2024

Note this bug is fixed in the 0.7.0 release of Mojo.

(obvs) ➜ obvs git:(main) ✗ mojo -v
mojo 0.7.0 (af002202)
(obvs) ➜ obvs git:(main) ✗ mojo obvs/gputest.🔥
[1 2 3]

@jcoombes jcoombes changed the title [BUG]: Segfault when importing numpy. [BUG]: Segfault when importing numpy on Mojo 0.4.1 Feb 3, 2024
@ematejska
Copy link
Collaborator

Thanks for trying with the latest release. Closing.

@ematejska ematejska added the mojo-repo Tag all issues with this label label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

2 participants