LCA-ActivityBrowser / activity-browser

GUI for brightway2
GNU Lesser General Public License v3.0
142 stars 54 forks source link

ValueError: unsupported pickle protocol: 5 #388

Closed jmehreth closed 4 years ago

jmehreth commented 4 years ago

When I want to run the AB by typing "activity-browser" in my virtual environment, I get the following error:

(ab) C:>activity-browser Traceback (most recent call last): File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\Scripts\activity-browser-script.py", line 5, in from activity_browser.app import run_activity_browser File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\activity_browser__init__.py", line 6, in from .app import Application, run_activity_browser File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\activity_browser\app__init.py", line 7, in from .application import Application File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\activity_browser\app\application.py", line 2, in from .controller import Controller File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\activity_browser\app\controller.py", line 6, in import brightway2 as bw File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\brightway2\init.py", line 2, in from bw2data import * File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\bw2data\init.py", line 35, in from .meta import ( File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\bw2data\meta.py", line 186, in geomapping = GeoMapping() File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\bw2data\meta.py", line 66, in init super(GeoMapping, self).init(*args, **kwargs) File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\bw2data\serialization.py", line 122, in init__ self.load() File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\bw2data\serialization.py", line 127, in load self.data = self.deserialize() File "C:\Users\mehr\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\bw2data\serialization.py", line 240, in deserialize return self.unpack(pickle.load(open(self.filepath, "rb"))) ValueError: unsupported pickle protocol: 5

Does anyone have an idea what could be the reason for this? After all, everything went fine with the installation.

Thanks in advance! Jonas

dgdekoning commented 4 years ago

Yes, this is caused because at some point brightway2 ran from python 3.8.

Specifically, at some point pickle files were created by brightway in python 3.8, these files cannot be unpickled (read) by any python version below 3.8. If possible, use python 3.8 from now on.

Another way to solve this would be to remove the affected project entirely (usually found C:\Users\<username>\AppData\Local\pylca\Brightway3), after this you can restart activity browser from a python 3.6 or 3.7 environment and it should work again.

MelanieDou commented 4 years ago

Hello, I have exactly the same problem. I tried creating a new environment with python 3.8. and installed the activity browser into this environment using "conda install -c conda-forge -c cmutel -c bsteubing -c haasad -c pascallesage "activity-browser>2.4" " but once this is done, I end up with an environment where the python version is 3.7.6. again. Can you help me? Thank you very much in advance, Mélanie

dgdekoning commented 4 years ago

It looks like everything is correct, can you add python=3.8 to the end of the command you use to install it?

The installation command would look similar to:

conda create -n ab -c conda-forge -c cmutel -c bsteubing -c haasad -c pascallesage "activity-browser>2.4" python=3.8
MelanieDou commented 4 years ago

Thank you for your quick reply. If I input this, I get the following error: error

dgdekoning commented 4 years ago

@MelanieDou, my apologies, you're absolutely right. This version conflict has been resolved in the development version for a while now and I never got around to pushing it to the stable branch.

You can use the 'development' version of the activity browser instead, which is still quite stable but will contain new features that might not be completely finished.

conda create -n ab_dev -c conda-forge -c cmutel -c bsteubing -c haasad -c pascallesage "activity-browser-dev>2019.10.30" python=3.8
MelanieDou commented 4 years ago

Yes! Works like a charm. Thank you very much

dgdekoning commented 4 years ago

Good to hear! Please don't hesitate to get in touch if you find problems with the development version :)

jmehreth commented 4 years ago

using the development version also did the trick for me. thanks!

dgdekoning commented 4 years ago

This should no longer be an issue in the future due to (currently unreleased) changes in brightway2-data, see here.