Barkhausen-Institut / hermespy

The Heterogeneous Radio Mobile Simulator
https://hermespy.org/
Other
36 stars 14 forks source link

Problem with example project #20

Open telearis opened 1 week ago

telearis commented 1 week ago

I tried to run the FMCW radar example (web: [1], source: [3]) But I get "UnicodeEncodeError: 'charmap' codec can't encode character '\u2834' in position 0: character maps to " and after that a lot of errors that include "frozen importlib._bootstrap" (see [3]).

Interpreter: Python 3.10 (conda environment) OS: Windows

[1] https://hermespy.org/api/radar.fmcw.html [2] source code: https://pastebin.com/Yg5kHefT [3] output: out.log

adlerjan commented 1 week ago

Hey, thanks for checking out HermesPy.

I can't reproduce that error on my system, neither on Python 3.10 nor on Python 3.11.

Which HermesPy version are you running and how did you install it? Which terminal are you running the example script from?

adlerjan commented 5 days ago

Since I can't reproduce and there's no further information, I'll consider this issue closed.

telearis commented 2 days ago

Hello, I am sorry, I had some other things to do and after that I was on vacation.

The hermespy version is 1.3.0 which I installed via pip in a Python 3.10.15 environment (conda). I also tried Python 3.11 and got the same error.

I am running the script either using Windows Terminal with Powershell or in a Jupyter Notebook using Visual Studio Code. In both cases, I get the same error messages.

adlerjan commented 1 day ago

Thanks for the update.

Could you post the output of

conda activate hermespy
pip list

And the error that should pop up when running this modified version of your example

from hermespy.radar import Radar, FMCW, ReceiverOperatingCharacteristic
from hermespy.simulation import Simulation, N0
from hermespy.channel import SingleTargetRadarChannel

# Create a new simulated scenario featuring a single device
simulation = Simulation()
device = simulation.new_device(noise_level=N0(2.5e-6), carrier_frequency=60e9)

# Configure the device to transmit and reveive radar waveforms
radar = Radar(device=device)
radar.waveform = FMCW(num_chirps=3, bandwidth=1e9, chirp_duration=1e-6, pulse_rep_interval=1.1e-6)

# Create a new radar channel with a single illuminated target
target = SingleTargetRadarChannel(1, 1., attenuate=True)
simulation.scenario.set_channel(device, device, target)

# Create a new detection probability evaluator
simulation.add_evaluator(ReceiverOperatingCharacteristic(radar, target))

# Generate a single simulation drop
drop = simulation.scenario.drop()

?

telearis commented 1 day ago

The command conda activate C:\conda\hermespy did not put out enything.

Confirming that the environment is selected: (Get-Command python).Source Output: C:\conda\hermespy\python.exe

Listing the packages: pip list > hermeypy_pip_list.txt Output: hermeypy_pip_list.txt

Running your code did not result in any output.

Running my code in the same activated environment resulted in errors: out2.log

telearis commented 1 day ago

I thought that the LLVM that I have installed on my system (for Sionna) might be interfering with the LLVM that hermespy is using. So I removed it from the path:

$newpath = ($env:path.Split(';') | where { $_ -inotmatch "llv" }) -join ";"
$env:path = $newpath

But that did not help.

Here are some example outputs (with PIDs removed for better diffing): with LLVM in path (same file as in my previous comment but without PIDs): out2_normalized.log without LLVM in path: out3_normalized.log without LLVM in path (another trial): out4_normalized.log

adlerjan commented 1 day ago

Okay, I'm suspecting it's not HermesPy that's acting up but rather its dependency Numba, namely the just-in-time compiler (jit).

Could you try and run the following snippet to verify?

from numba import jit

@jit
def f(x, y):
    # A somewhat trivial example
    return x + y

print(f(5, 6))
adlerjan commented 1 day ago

I thought that the LLVM that I have installed on my system (for Sionna) might be interfering with the LLVM that hermespy is using. So I removed it from the path:

$newpath = ($env:path.Split(';') | where { $_ -inotmatch "llv" }) -join ";"
$env:path = $newpath

But that did not help.

Here are some example outputs (with PIDs removed for better diffing): with LLVM in path (same file as in my previous comment but without PIDs): out2_normalized.log without LLVM in path: out3_normalized.log without LLVM in path (another trial): out4_normalized.log

Yes, I agree, the culprit is most likely LLVM Numba depends on. If there were incompatible dependencies during the install of Numba it might have messed with Numba's LLVMLite configuration.

telearis commented 1 day ago

The numba program you gave prints out "11" without errors.

telearis commented 6 hours ago

No success so far. What I tried:

  1. uninstall LLVM
  2. reboot Windows
  3. create a new conda environment: conda create python=3.11 -p C:\conda\hermespy3
  4. activate the conda environment: conda activate C:\conda\hermespy3
  5. install hermespy: pip install --force-reinstall --ignore-installed --no-cache-dir hermespy
  6. run the script (see first post)

The same kind of errors appear.