modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
23.26k stars 2.59k forks source link

[BUG]: I am sending you the error output when executing the attached Mojo code. #1797

Open icst005 opened 8 months ago

icst005 commented 8 months ago

Bug description

-------------------------- Error Code ---------------------------- ic@DESKTOP-4QPI781:~$ '/home/ic/.modular/pkg/packages.modular.com_mojo/bin/mojo' '/home/ic/test11.mojo' [2416:2416:20240223,165143.278591:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2) [2416:2416:20240223,165143.279534: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:

  1. Program arguments: /home/ic/.modular/pkg/packages.modular.com_mojo/bin/mojo /home/ic/test11.mojo

    0 0x0000562f606b0877 (/home/ic/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x620877)

    1 0x0000562f606ae44e (/home/ic/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x61e44e)

    2 0x0000562f606b0f4f (/home/ic/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x620f4f)

    3 0x00007f3b21bfe520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)

    Segmentation fault

------------------------- test11.mojo ---------------------- from python import Python

fn main() raises:

from python import Python

# 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)

------------------------- Execution environment information --------------------- Windows11 Celeron N4000/4GB/64GB eMMC MOUSE CONPUTER MODEL:MT-E10ZN (https://www.amazon.co.jp/mouse-%E3%82%B9%E3%82%BF%E3%83%87%E3%82%A3%E3%83%91%E3%82%BD%E3%82%B3%E3%83%B3-10-1%E5%9E%8B%E3%82%BF%E3%83%96%E3%83%AC%E3%83%83%E3%83%88PC-Celeron-MT-E10ZN/dp/B09MT6ZC2F

・Follow 「Set up on Windows」 procedure at the following URL and confirm that you have successfully executed 06.Get started with Hello World!

 ※The same applies to execution from the RUN button on VSCode or from the Ubuntu terminal.

【What I tried to solve the error】 ・In VSCode, in EXTENSIONS, I installed Python Extended. ・From the Ubuntu terminal, I ran the following   sudo apt update   sudo apt install python3-pip   pip3 install numpy

Steps to reproduce

System information

- What OS did you do install Mojo on ?
- Provide version information for Mojo by pasting the output of `mojo -v`
- Provide Modular CLI version by pasting the output of `modular -v`
dimitrilw commented 4 months ago

tl;dr

Granted, @icst005 is on Linux and I'm on MacOS (BSD) and I was using Mojo Nightly 2024.6.2115 (c0b36f30), so this comment of mine is immediately somewhat suspect. However, I think more information is needed from @icst005 , or perhaps the issue should be closed.

steps taken

When I tried to replicate the issue, I made this .mojo file:

from python import Python as py

fn main() raises:
    var np = py.import_module("numpy")
    var array = np.array([1, 2, 3])
    print(array)

I confirmed that I have numpy installed.

image

When running, here was the result, as expected:

image