Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

numpy attribute error #48

Open
ulloaa opened this issue Dec 21, 2022 · 8 comments
Open

numpy attribute error #48

ulloaa opened this issue Dec 21, 2022 · 8 comments

Comments

@ulloaa
Copy link

ulloaa commented Dec 21, 2022

Hello, I followed the steps to install a linux conda environment and run pore-c-snakemake. However, I get the following error when running the test data set:

AttributeError in line 1 of /Pore-C-Snakemake/Snakefile:
module 'numpy' has no attribute 'bool'
  File "/Pore-C-Snakemake/Snakefile", line 1, in <module>
  File "/conda/envs/pore-c-snakemake/lib/python3.8/site-packages/pandas/__init__.py", line 180, in <module>
  File "/conda/envs/pore-c-snakemake/lib/python3.8/site-packages/pandas/testing.py", line 5, in <module>
  File "/conda/envs/pore-c-snakemake/lib/python3.8/site-packages/pandas/_testing.py", line 24, in <module>
  File "pandas/_libs/testing.pyx", line 10, in init pandas._libs.testing
  File "/conda/envs/pore-c-snakemake/lib/python3.8/site-packages/numpy/__init__.py", line 284, in __getattr__

The following are the versions of numpy and python that came with the environment:

(pore-c-snakemake) [/Pore-C-Snakemake ] $ mamba list | grep numpy
numpy                     1.24.0           py38hab0fcb9_0    conda-forge
(pore-c-snakemake) [/Pore-C-Snakemake ] $ mamba list | grep python
gitpython                 3.1.29             pyhd8ed1ab_0    conda-forge
google-api-python-client  2.70.0             pyhd8ed1ab_0    conda-forge
python                    3.8.15          h4a9ceb5_0_cpython    conda-forge

Do you have any suggestions on how to solve the error above?

Thank you.

@eharr
Copy link
Collaborator

eharr commented Dec 22, 2022

Hi @ulloaa,

That's a strange error.

Is it picking up the correct version of the snakemake executable? If you do which snakemake you should see the one in the pore-c-snakemake conda environment. Another way to run it is python -m snakemake (assuming that which python returns the correct version).

It might be worth pinning a specific version of numpy in the environment.yaml file by adding the line - numpy=1.23.0 to it?

Sorry - that's all I can think of for now.

@jlguidubaldi1
Copy link

To build off of the above, I received a very similar Attribute Error when I ran it; though it returned AttributeError: module 'numpy' has no attribute 'object'. Did you mean: 'object_'?, as opposed to module 'numpy' has no attribute 'bool'. Will update if specifying the numpy version in the .yaml fixes this.

@jlguidubaldi1
Copy link

Update: I appear to still receive the same Attribute Error message even after pinning numpy 1.23.0 in the environment.yml file. I also then tried pinning numpy 1.24.0 but got the same results.

@eharr
Copy link
Collaborator

eharr commented Dec 23, 2022

There's something wrong with your python environment - have you successfully created conda environments before? It's a long shot, but you don't have a "numpy.py" file in your path? (https://bobbyhadz.com/blog/python-attributeerror-module-numpy-has-no-attribute-array).

It might help to attach the output of the "env" command along with "which python"

@ulloaa
Copy link
Author

ulloaa commented Jan 4, 2023

Hello, we continue to have the same error, with two independently created environments, one by @jlguidubaldi1 and the other one by myself. Can I ask which python version did your use in your tests? Thanks.

@Chao-Guo-hub
Copy link

Chao-Guo-hub commented Jan 9, 2023

I also faced the same problem, but I solved it by reinstalling numpy 2.3.1 version.
pip uninstall numpy
pip install numpy==1.23.1

@Chao-Guo-hub
Copy link

Not only will there be problems with the numpy version of the initial environment, but the conda sub-environment created for the cooler will also have problems with the numpy version during subsequent runs. I solved it smoothly by adding -numpy==1.23.1 to the Pore-C-Snakemake/envs/cooler.yml file.
Recent numpy updates removed a lot of old functionality, fixed versions now seem to be a more significant issue.

@ulloaa
Copy link
Author

ulloaa commented Jan 9, 2023

Completely agree. We fixed our attribute error(s) by downgrading numpy in the main environment as well as in the other environments that were automatically created by the first snakemake run. In retrospect, this was an easy fix but we spent many days working on it because we were overlooking the environments automatically created by snakemake at runtime. A more permanent fix could be achieved by specifying the complete environment in the yml files. It would be great if the authors could do that directly in the repository. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants