Closed Y-valencia closed 4 years ago
Hi - The root of this problem (ValueError: unsupported pickle protocol: 5) comes from an issue with brightway2-data, which should have been resolved by the commit they pushed in mid-April (https://github.com/brightway-lca/brightway2-data/commit/09f13b22e651e0d496f0eff63ef984c4e8ea637d)
Can you try updating brightway (or just the brightway2-data package) and see if that helps?
The issue (described here https://github.com/brightway-lca/brightway2-data/issues/68) is that brightway2data used to use the highest available pickle protocol to save its data files. Python 3.8 introduced pickle 5 which means that if you ever open something in a python 3.8 brightway environment, it breaks backwards compatability to any 3.6/3.7 environments as they don't have the right version of pickle to open any data files. The commit above hard codes pickle 4 as the protocol to use in order to try and restore backwards compatability.
You might need to open up your 3.8 environment, load up brightway, load up the LCOPT_SETUP projects within brightway (using projects
to get a list and projects.set_current('project name')
to open them up) in order to re-save the datafiles in a version the lcopt environment can understand. Does that make sense?
I'll look into what's going on with numpy/scipy versions - there's some kind of conflict in the conda environments - but this should work as a short term fix.
Let me know if this helps and I can close this issue.
Just checked and the latest pypi distribution of bw2data doesn't include the update, so updating via pip won't help.
The conda distribution doesn't include the new bugfix either
My guess is that it's coming as part of a bigger update - installing the dev version of just bw2data from github breaks brightway - I'll work on getting lcopt python 3.8 compatible and get back to you
ok - this is a highly unrecommended fix, messing with the code in existing packages in your environment can cause unintended problems
Having said that it worked for me and doesn't seem to have had any other ill effects yet...
C:\Users\<username>\AppData\Local\Continuum\miniconda3\envs\<env name>\Lib\site-packages\bw2data
pickle.HIGHEST_PROTOCOL
in all files and replace it with 4
(it should find 6 instances in 5 files - data_store.py
, serialization.py
, sqlite.py
, base.py
and database.py
)from brightway2 import *
import os
from bw2data.serialization import PickledDict
# Subclass PickledDict to give it a filename (but nothing else)
class RePickler(PickledDict):
def __init__(self, filename, *args, **kwargs):
self.filename = filename
super(RePickler, self).__init__(*args, **kwargs)
# Find all of the pickles that are currently in protocol 5
pickle_list = [x for x in os.listdir(projects.dir) if os.path.splitext(x)[1] == '.pickle']
# Repickle them in protocol 4
for x in pickle_list:
repickler = RePickler(x)
repickler.serialize()
repickler = None
Hello, I've been trying this for days now, so i come to ask for help. When installing the regular version of lcopt-dev,I got the version 0.4.2, so I try to force the installation as said in #72 but got this error: -the version of numpy needs to be 1.13.3 or above = when trying to update i get a cuda driver issue -i make this env in python 3.6, i also tried to run the env in python 3.8 and didn't work either
does anyone have the same problem? or some recommendations about which path should i follow to succesfully install it?
thanks in advance
The error i get:
C:\Users\y\anaconda3\envs\lcopt-dev\lib\site-packages\scipy__init__.py:115: UserWarning: Numpy 1.13.3 or above is required for this version of scipy (detected version 1.11.3) UserWarning)
ValueError Traceback (most recent call last)