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

TypeError: object.__new__(BlockManager) is not safe, use BlockManager.__new__() #33

Open
jdwinkler-lanzatech opened this issue Jul 14, 2021 · 17 comments

Comments

@jdwinkler-lanzatech
Copy link

Hi,

I'm suddenly getting a type error when analyzing an assembly:

Traceback (most recent call last):
	File "/usr/local/bin/phigaro", line 5, in <module>
	from phigaro.cli.batch import main
	File "/usr/local/lib/python3.7/site-packages/phigaro/cli/batch.py", line 20, in <module>
	from phigaro.batch.task.run_phigaro import RunPhigaroTask
	File "/usr/local/lib/python3.7/site-packages/phigaro/batch/task/run_phigaro.py", line 21, in <module>
	from phigaro.to_html.preprocess import plot_html, form_sequence, if_transposable
	File "/usr/local/lib/python3.7/site-packages/phigaro/to_html/preprocess.py", line 40, in <module>
	annotations = pickle.load(f)
	File "/usr/local/lib/python3.7/copyreg.py", line 43, in _reconstructor
	obj = object.__new__(cls)
	TypeError: object.__new__(BlockManager) is not safe, use BlockManager.__new__()
	Traceback (most recent call last):
	File "phigaro_helper.py", line 136, in <module>
	unknown_arguments=unknown)
	File "/home/annotator/pipeline_script_base.py", line 241, in execute
	config_dict=config_dict)
	File "phigaro_helper.py", line 41, in entrypoint
	debug=parsed_arguments.debug)
	File "phigaro_helper.py", line 110, in run_command
	shell=True)
	File "/usr/local/lib/python3.7/subprocess.py", line 363, in check_call
	raise CalledProcessError(retcode, cmd)

I'm not sure exactly what stage the program is failing at, but it looks like the HTML output preprocessing stage. I am actually specifying gff and tsv outputs only though using the following command:

phigaro -c config.yml -f assembly.fasta -e gff tsv --delete-shorts -o /tmp/tmpwbar6v85 -t 2

If you have any suggestions on a workaround or fix, please let me know. I am running phigaro 2.3.0 in a docker container based upon python 3.7 with all the prereqs installed.

@PollyTikhonova
Copy link
Collaborator

I am so sorry, I've lost your message before, and bumped into it just now. If you are still interested, please, send me the files assembly.fasta and /tmp/tmpwbar6v85 to my email tikhonova.polly@mail.ru and I'll figure out the problem.

@jdwinkler-lanzatech
Copy link
Author

No worries! Let me see if I can reproduce a minimal example and send you more details early next week.

@PollyTikhonova
Copy link
Collaborator

Thank you! will waait

@WuJiaWei121
Copy link

When I execute the following command:
phigaro - F test_ data/Bacillus_ anthracis_ str_ ames.fna -o test_ data/Bacillus_ anthracis_ str_ The Ames - P -- not open

I encountered a mistake:
Traceback (most recent call last):
File "/data4/wujiawei/envs/phigaro/bin/phigaro", line 5, in
from phigaro.cli.batch import main
File "/data4/wujiawei/envs/phigaro/lib/python3.7/site-packages/phigaro/cli/batch.py", line 20, in
from phigaro.batch.task.run_phigaro import RunPhigaroTask
File "/data4/wujiawei/envs/phigaro/lib/python3.7/site-packages/phigaro/batch/task/run_phigaro.py", line 21, in
from phigaro.to_html.preprocess import plot_html, form_sequence, if_transposable
File "/data4/wujiawei/envs/phigaro/lib/python3.7/site-packages/phigaro/to_html/preprocess.py", line 40, in
annotations = pickle.load(f)
File "/data4/wujiawei/envs/phigaro/lib/python3.7/copyreg.py", line 43, in _reconstructor
obj = object.new(cls)
TypeError: object.new(BlockManager) is not safe, use BlockManager.new()

How can I solve this problem?

@PollyTikhonova
Copy link
Collaborator

Hello,
Please try to update pickle and/or copyreg lib
If it still doesn't work, please send the result of pip freeze command

@ATCHON
Copy link

ATCHON commented Oct 26, 2021

Hello,
I have almost the same error message after installing and configuring phigaro.
The phigaro-setup command gives me the help menu while thephigaro -h command gives me this error message :

Traceback (most recent call last):
File "/home/user2b2s/miniconda3/envs/phigaro_env/bin/phigaro", line 5, in
from phigaro.cli.batch import main
File "/home/user2b2s/miniconda3/envs/phigaro_env/lib/python3.7/site-packages/phigaro/cli/batch.py", line 20, in
from phigaro.batch.task.run_phigaro import RunPhigaroTask
File "/home/user2b2s/miniconda3/envs/phigaro_env/lib/python3.7/site-packages/phigaro/batch/task/run_phigaro.py", line 21, in
from phigaro.to_html.preprocess import plot_html, form_sequence, if_transposable
File "/home/user2b2s/miniconda3/envs/phigaro_env/lib/python3.7/site-packages/phigaro/to_html/preprocess.py", line 40, in
annotations = pickle.load(f)
File "/home/user2b2s/miniconda3/envs/phigaro_env/lib/python3.7/copyreg.py", line 43, in _reconstructor
obj = object.new(cls)
TypeError: object.new(BlockManager) is not safe, use BlockManager.new()

Do you have a suggestion to help me solve this problem?
Thank you for your understanding

@WuJiaWei121
Copy link

Hello,
I installed phigaro with pip and then this error occurred.
After uninstalling phigaro, I used conda to install it to solve this problem.
the command is:
conda install -c bioconda phigaro

@ATCHON
Copy link

ATCHON commented Oct 26, 2021

Thanks for your help.
It is OK for me after installing with: conda install -c bioconda phigaro

@jdwinkler-lanzatech
Copy link
Author

The conda distribution also works for me.

@duboism
Copy link

duboism commented Jul 26, 2022

I have the same issue when installing with pip. I think it's related to recent versions of pandas (I have no issue when I use pandas 1.2.0).

If I'm correct, phigaro unpickles 2 files:

  • the family related to some pVOGs (file pvogs_taxonomy.pickle)
  • the description of some pVOGS (file to_html/pvogs_annotations.pickle)

I think that using pickle to load those data is not a goad idea: it's simple tabular data so could be put in two CSV files (which are easier to work with) or even merged into one. Also I was wondering if those files should be put alongside the HMM models and downloaded upon installation.

@Sanrrone
Copy link

Sanrrone commented May 15, 2023

Hi!, in my case still getting the same error.
I tried conda installation but I have no luck:

conda install -c bioconda phigaro
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: / 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                            

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your system:

  - feature:/linux-64::__unix==0=0
  - feature:|@/linux-64::__unix==0=0
  - phigaro -> sh -> __unix

Your installed version is: 0

I tried pip and repo installation but still getting the same error about BlockManager, what can I do?

@PollyTikhonova
Copy link
Collaborator

Hi @Sanrrone, would you please try and create a new fresh environment with python 3.7 and try install phigaro to this environment?
I would also appretiate if you could send me specification of your current conda environment, so that I could troubleshoot the issue.
But clean environment with older python version should help for now

@Sanrrone
Copy link

Sanrrone commented May 17, 2023

Hi!, a new conda enviroment using python3.7 as you suggest worked at the end. Is a longer workaround for my scripts since my other software uses newer python versions but, finally I can continue!
thanks you very much

@oliverdrechsel
Copy link

Hi @PollyTikhonova ,

unfortunately, i do get the same error message. Phigaro doesn't even start after a fresh install to show help.

$ mamba env create -f environment.yml -p ../phigaro_env
$ phigaro-setup

$ phigaro
Traceback (most recent call last):
  File "/scratch.../phigaro_env/bin/phigaro", line 5, in <module>
    from phigaro.cli.batch import main
  File "/scratch.../phigaro_env/lib/python3.7/site-packages/phigaro/cli/batch.py", line 20, in <module>
    from phigaro.batch.task.run_phigaro import RunPhigaroTask
  File "/scratch.../phigaro_env/lib/python3.7/site-packages/phigaro/batch/task/run_phigaro.py", line 21, in <module>
    from phigaro.to_html.preprocess import plot_html, form_sequence, if_transposable
  File "/scratch.../phigaro_env/lib/python3.7/site-packages/phigaro/to_html/preprocess.py", line 40, in <module>
    annotations = pickle.load(f)
  File "/scratch.../phigaro_env/lib/python3.7/copyreg.py", line 43, in _reconstructor
    obj = object.__new__(cls)
TypeError: object.__new__(BlockManager) is not safe, use BlockManager.__new__()

The same error message keeps popping up even if I setup a fresh python3.7.12 conda environment and install phigaro with pip.

Do you have any idea what i could be doing wrong?

thanks a lot

@PollyTikhonova
Copy link
Collaborator

Thanks everyone for contributing to this topic!
In phigaro 2.4.0 we finally got rid of the .pickle files and fixed other compatibility issues. So, now the installation installation of v2.4.0 should not encounter into BlockManager error and hopefully neither into any others.

@F0zko
Copy link

F0zko commented Apr 26, 2024

Hi,

I am a non very coding experienced student trying to open some environmental sciences pickle file. Using the same code from the article I took the data from, I get the error :
TypeError Traceback (most recent call last)
File ~/opt/anaconda3/lib/python3.11/site-packages/pandas/io/pickle.py:206, in read_pickle(filepath_or_buffer, compression, storage_options)
205 warnings.simplefilter("ignore", Warning)
--> 206 return pickle.load(handles.handle)
207 except excs_to_catch:
208 # e.g.
209 # "No module named 'pandas.core.sparse.series'"
210 # "Can't get attribute '__nat_unpickle' on <module 'pandas._libs.tslib"

File ~/opt/anaconda3/lib/python3.11/copyreg.py:49, in _reconstructor(cls, base, state)
48 if base is object:
---> 49 obj = object.new(cls)
50 else:

TypeError: object.new(BlockManager) is not safe, use BlockManager.new()

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last)
Cell In[3], line 9
6 warnings.simplefilter("ignore", category=DeprecationWarning)
8 # Charger les données de précipitations et d'écoulement
----> 9 ppt = pd.read_pickle('elder_ppt.p')
10 df = pd.read_pickle('df_elder.p')
...
---> 49 obj = object.new(cls)
50 else:
51 obj = base.new(cls, state)

TypeError: object.new(BlockManager) is not safe, use BlockManager.new()

I tried to install and older version of pandas and an older version of python and neither worked. as for the phigaro thing I don't get it.

I also tried to correct the anaconda file following the instructions "use BlockManager.new()" but ended up fucking it and had to reinstall the whole thing

I specify that I work on a Mac with ARM chip

Thanks in advance !

@PollyTikhonova
Copy link
Collaborator

Hi @F0zko! Which version of Phigaro you are using? Would it be possible for you to install the latest version phigaro 2.4.0?

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

No branches or pull requests

8 participants