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

RuntimeError: Error parsing the label: in python functions and example files #1557

Closed
espenhgn opened this issue May 27, 2021 · 6 comments · Fixed by #1599
Closed

RuntimeError: Error parsing the label: in python functions and example files #1557

espenhgn opened this issue May 27, 2021 · 6 comments · Fixed by #1599
Labels

Comments

@espenhgn
Copy link
Collaborator

espenhgn commented May 27, 2021

Describe the bug
Python examples are using seemingly deprecated location label syntax, for instance:

% cd <arbor>/python/example
% python single_cell_detailed_recipe.py single_cell_detailed.swc
Traceback (most recent call last):
  File "/Users/espenhagen/Repositories/arbor/python/example/single_cell_detailed_recipe.py", line 29, in <module>
    labels['soma'] = '(tag 1)'
RuntimeError: 
----- internal error -------------------------------------------
Error parsing the label: 'soma' = '(tag 1)'

bad any cast

Please file a bug report with this full error message at:
    github.com/arbor-sim/arbor/issues
----------------------------------------------------------------

Several such cases may also be present as defaults in arbor itself, for example:

>>> help(arbor.cv_policy_single)

Help on built-in function cv_policy_single in module arbor._arbor:

cv_policy_single(...) method of builtins.PyCapsule instance
    cv_policy_single(domain: str = '(all)') -> arbor._arbor.cv_policy

hence

>>> arbor.cv_policy_single()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Invalid region description: '(all)' is neither a valid region expression or region label string.

Additional context
conda env/installation:

conda create -n arbor2 python=3.9 pip numpy pandas seaborn cmake c-compiler cxx-compiler nlohmann_json sphinx svgwrite -c conda-forge -y
conda activate arbor2
cd <arbor>
git checkout a304d5ac7
pip install -v .
... 
% python -c "import arbor; print(arbor.__version__, arbor.__file__)"
0.5.1-dev /Users/espenhagen/miniforge3/envs/arbor2/lib/python3.9/site-packages/arbor/__init__.py # seems correct
@espenhgn espenhgn added the bug label May 27, 2021
@schmitts
Copy link
Contributor

I'm trying to reproduce your conda installation. Are you sure it's what you've done 1:1? conda activate arbor2 would need to be conda activate python=3.9. Also without git submodule init && git submodule update installation fails for me (can't find pybind11).

With these changes python single_cell_detailed_recipe.py single_cell_detailed.swc works.

@espenhgn
Copy link
Collaborator Author

espenhgn commented May 27, 2021

Sorry, it should've been conda create -n arbor2 python=3.9 pip ... above. I didn't do a fresh clone of the arbor repo hence the submodules were already in place in my case.

I now made a clean clone of arbor into another destination; checked out revision a304d5a; initialized and updated the submodules and trashed/rebuilt the conda environment, reinstalled arbor and still see the same error.

Additional conda info:

% conda list
# packages in environment at /Users/espenhagen/miniforge3/envs/arbor2:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12                     py_0    conda-forge
arbor                     0.5.1.dev0               pypi_0    pypi
babel                     2.9.1              pyh44b312d_0    conda-forge
brotlipy                  0.7.0           py39h46acfd9_1001    conda-forge
bzip2                     1.0.8                h3422bc3_4    conda-forge
c-ares                    1.17.1               h27ca646_1    conda-forge
c-compiler                1.1.3                h27ca646_0    conda-forge
ca-certificates           2020.12.5            h4653dfc_0    conda-forge
cctools                   949.0.1             ha9384d2_21    conda-forge
cctools_osx-arm64         949.0.1             h92b3a8a_21    conda-forge
certifi                   2020.12.5        py39h2804cbe_1    conda-forge
cffi                      1.14.5           py39h702c04f_0    conda-forge
chardet                   4.0.0            py39h2804cbe_1    conda-forge
clang                     11.1.0               hce30654_1    conda-forge
clang-11                  11.1.0          default_h0fdd720_1    conda-forge
clang_osx-arm64           11.1.0               h54d7cd3_2    conda-forge
clangxx                   11.1.0          default_h8b1a7b7_1    conda-forge
clangxx_osx-arm64         11.1.0               hb84c830_2    conda-forge
cmake                     3.20.2               h6f0b043_1    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
compiler-rt               11.1.0               h7d99272_0    conda-forge
compiler-rt_osx-arm64     11.1.0               h103ad0d_0    conda-forge
cryptography              3.4.7            py39h73257c9_0    conda-forge
cxx-compiler              1.1.3                h260d524_0    conda-forge
cycler                    0.10.0                     py_2    conda-forge
docutils                  0.17.1           py39h2804cbe_0    conda-forge
expat                     2.4.1                hbdafb3b_0    conda-forge
freetype                  2.10.4               h17b34a0_1    conda-forge
idna                      2.10               pyh9f0ad1d_0    conda-forge
imagesize                 1.2.0                      py_0    conda-forge
jbig                      2.1               h3422bc3_2003    conda-forge
jinja2                    3.0.1              pyhd8ed1ab_0    conda-forge
jpeg                      9d                   h27ca646_0    conda-forge
kiwisolver                1.3.1            py39h5a63225_1    conda-forge
krb5                      1.19.1               hd92b7a7_0    conda-forge
lcms2                     2.12                 had6a04f_0    conda-forge
ld64                      530                 h08716b2_21    conda-forge
ld64_osx-arm64            530                 ha291f0b_21    conda-forge
ldid                      2.1.2                h34db0f2_2    conda-forge
lerc                      2.2.1                h9f76cd9_0    conda-forge
libblas                   3.9.0                9_openblas    conda-forge
libcblas                  3.9.0                9_openblas    conda-forge
libclang-cpp11.1          11.1.0          default_h0fdd720_1    conda-forge
libcurl                   7.77.0               h8fe1914_0    conda-forge
libcxx                    11.1.0               h168391b_0    conda-forge
libdeflate                1.7                  h27ca646_5    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h642e427_1    conda-forge
libffi                    3.3                  h9f76cd9_2    conda-forge
libgfortran               5.0.0.dev0      11_0_1_hf114ba7_22    conda-forge
libgfortran5              11.0.1.dev0         hf114ba7_22    conda-forge
liblapack                 3.9.0                9_openblas    conda-forge
libllvm11                 11.1.0               h93073aa_2    conda-forge
libnghttp2                1.43.0               hf3018f0_0    conda-forge
libopenblas               0.3.15          openmp_hf330de4_1    conda-forge
libpng                    1.6.37               hf7e6567_2    conda-forge
libssh2                   1.9.0                hb80f160_6    conda-forge
libtiff                   4.3.0                hc6122e1_1    conda-forge
libuv                     1.41.0               h27ca646_0    conda-forge
libwebp-base              1.2.0                h27ca646_2    conda-forge
llvm-openmp               11.1.0               hf3c4609_1    conda-forge
llvm-tools                11.1.0               h93073aa_2    conda-forge
lz4-c                     1.9.3                h9f76cd9_0    conda-forge
markupsafe                2.0.1            py39h5161555_0    conda-forge
matplotlib-base           3.4.2            py39h5aa4fe7_0    conda-forge
ncurses                   6.2                  h9aa5885_4    conda-forge
nlohmann_json             3.9.1                hbdafb3b_1    conda-forge
numpy                     1.20.3           py39h1f3b974_1    conda-forge
olefile                   0.46               pyh9f0ad1d_1    conda-forge
openjpeg                  2.4.0                h062765e_1    conda-forge
openssl                   1.1.1k               h27ca646_0    conda-forge
packaging                 20.9               pyh44b312d_0    conda-forge
pandas                    1.2.4            py39h7f752ed_0    conda-forge
patsy                     0.5.1                      py_0    conda-forge
pillow                    8.2.0            py39h282ff46_1    conda-forge
pip                       21.1.2             pyhd8ed1ab_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pygments                  2.9.0              pyhd8ed1ab_0    conda-forge
pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pysocks                   1.7.1            py39h2804cbe_3    conda-forge
python                    3.9.4           h5b20da3_0_cpython    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.9                      1_cp39    conda-forge
pytz                      2021.1             pyhd8ed1ab_0    conda-forge
readline                  8.1                  hedafd6a_0    conda-forge
requests                  2.25.1             pyhd3deb0d_0    conda-forge
rhash                     1.4.1                h27ca646_0    conda-forge
scipy                     1.6.3            py39h5060c3b_0    conda-forge
seaborn                   0.11.1               hd8ed1ab_1    conda-forge
seaborn-base              0.11.1             pyhd8ed1ab_1    conda-forge
setuptools                49.6.0           py39h2804cbe_3    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snowballstemmer           2.1.0              pyhd8ed1ab_0    conda-forge
sphinx                    4.0.2              pyh6c4a22f_1    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    2.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_0    conda-forge
sqlite                    3.35.5               hc49ca36_0    conda-forge
statsmodels               0.12.2           py39h038c1d3_0    conda-forge
svgwrite                  1.4.1              pyhd8ed1ab_0    conda-forge
tapi                      1100.0.11            he4954df_0    conda-forge
tk                        8.6.10               hf7e6567_1    conda-forge
tornado                   6.1              py39h46acfd9_1    conda-forge
tzdata                    2021a                he74cb21_0    conda-forge
urllib3                   1.26.5             pyhd8ed1ab_0    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
xz                        5.2.5                h642e427_1    conda-forge
zlib                      1.2.11            h31e879b_1009    conda-forge
zstd                      1.5.0                h861e0a7_0    conda-forge
% conda info

     active environment : arbor2
    active env location : /Users/espenhagen/miniforge3/envs/arbor2
            shell level : 2
       user config file : /Users/espenhagen/.condarc
 populated config files : /Users/espenhagen/miniforge3/.condarc
                          /Users/espenhagen/.condarc
          conda version : 4.10.1
    conda-build version : not installed
         python version : 3.9.2.final.0
       virtual packages : __osx=11.3=0
                          __unix=0=0
                          __archspec=1=arm64
       base environment : /Users/espenhagen/miniforge3  (writable)
      conda av data dir : /Users/espenhagen/miniforge3/etc/conda
  conda av metadata url : https://repo.anaconda.com/pkgs/main
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/espenhagen/miniforge3/pkgs
                          /Users/espenhagen/.conda/pkgs
       envs directories : /Users/espenhagen/miniforge3/envs
                          /Users/espenhagen/.conda/envs
               platform : osx-arm64
             user-agent : conda/4.10.1 requests/2.25.1 CPython/3.9.2 Darwin/20.4.0 OSX/11.3
                UID:GID : 501:20
             netrc file : None
           offline mode : False

@schmitts
Copy link
Contributor

schmitts commented May 27, 2021

I'm still suspecting an environment issue. Can you please - in a fresh shell - do the following?

conda env remove -v --name arbor2
conda create -n arbor2 python=3.9 pip numpy pandas seaborn cmake c-compiler cxx-compiler nlohmann_json sphinx svgwrite -c conda-forge -y
conda activate arbor2
git clone https://github.com/arbor-sim/arbor
cd arbor
git submodule init
git submodule update
pip install -v .
cd python/example
python single_cell_detailed_recipe.py single_cell_detailed.swc

@espenhgn
Copy link
Collaborator Author

That still doesn't work; I even went through the trouble of creating a new user, installed miniforge and arbor locally. The examples still fail. The issue seems to arise on my M1 (arm64) mac, only. I had no issues testing the current master on an older mac w. Intel hardware, as well as on an Ubuntu VM.

To me it appears as though something subtle got introduced in the last month or so causing this issue, as per 93faa63 everything worked fine. Perhaps someone with an M1 mac can verify?

@espenhgn
Copy link
Collaborator Author

On my end 595e4e3 (#1505) works, e8b08ca (#1510) and newer is broken. Reverting e8b08ca onto the current master (a304d5a) works.

@schmitts
Copy link
Contributor

Thanks for your efforts! I'll escalate your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants