phigaro icon indicating copy to clipboard operation
phigaro copied to clipboard

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

Open jdwinkler-lanzatech opened this issue 3 years ago • 17 comments

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.

jdwinkler-lanzatech avatar Jul 14 '21 15:07 jdwinkler-lanzatech

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 [email protected] and I'll figure out the problem.

PollyTikhonova avatar Aug 27 '21 18:08 PollyTikhonova

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

jdwinkler-lanzatech avatar Aug 27 '21 18:08 jdwinkler-lanzatech

Thank you! will waait

PollyTikhonova avatar Aug 27 '21 18:08 PollyTikhonova

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?

WuJiaWei121 avatar Sep 08 '21 02:09 WuJiaWei121

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

PollyTikhonova avatar Sep 08 '21 11:09 PollyTikhonova

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

ATCHON avatar Oct 26 '21 11:10 ATCHON

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

WuJiaWei121 avatar Oct 26 '21 12:10 WuJiaWei121

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

ATCHON avatar Oct 26 '21 14:10 ATCHON

The conda distribution also works for me.

jdwinkler-lanzatech avatar Oct 26 '21 18:10 jdwinkler-lanzatech

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.

duboism avatar Jul 26 '22 11:07 duboism

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?

Sanrrone avatar May 15 '23 12:05 Sanrrone

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

PollyTikhonova avatar May 16 '23 20:05 PollyTikhonova

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

Sanrrone avatar May 17 '23 04:05 Sanrrone

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

oliverdrechsel avatar Nov 15 '23 19:11 oliverdrechsel

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.

PollyTikhonova avatar Jan 15 '24 22:01 PollyTikhonova

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 !

F0zko avatar Apr 26 '24 23:04 F0zko

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

PollyTikhonova avatar Apr 29 '24 16:04 PollyTikhonova