Upgrade error: cannot import name 'serialized_length'

Hello,

I have been plotting and working on getting my farm up and running. I have recently attempted to update and upgrade my chia software by following the instructions on the main installation page. When I get to the step chia stop -d all I get the following message with an error at the end.

(venv) eric@ChiaLinux:~/chia-blockchain$ chia stop -d all
Traceback (most recent call last):
  File "/home/eric/chia-blockchain/venv/bin/chia", line 33, in <module>
    sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia')())
  File "/home/eric/chia-blockchain/chia/cmds/chia.py", line 77, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/eric/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/eric/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/eric/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/eric/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/eric/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/eric/chia-blockchain/venv/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/eric/chia-blockchain/chia/cmds/stop.py", line 46, in stop_cmd
    sys.exit(asyncio.get_event_loop().run_until_complete(async_stop(ctx.obj["root_path"], group, daemon)))
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/eric/chia-blockchain/chia/cmds/stop.py", line 10, in async_stop
    from chia.daemon.client import connect_to_daemon_and_validate
  File "/home/eric/chia-blockchain/chia/daemon/client.py", line 9, in <module>
    from chia.server.server import ssl_context_for_client
  File "/home/eric/chia-blockchain/chia/server/server.py", line 19, in <module>
    from chia.protocols.shared_protocol import protocol_version
  File "/home/eric/chia-blockchain/chia/protocols/shared_protocol.py", line 6, in <module>
    from chia.util.streamable import Streamable, streamable
  File "/home/eric/chia-blockchain/chia/util/streamable.py", line 14, in <module>
    from chia.types.blockchain_format.program import Program, SerializedProgram
  File "/home/eric/chia-blockchain/chia/types/blockchain_format/program.py", line 10, in <module>
    from clvm_rs import STRICT_MODE, deserialize_and_run_program, serialized_length
**ImportError: cannot import name 'serialized_length' from 'clvm_rs' (/home/eric/chia-blockchain/venv/lib/python3.8/site-packages/clvm_rs.cpython-38-x86_64-linux-gnu.so)**

I believe the last line is an error that is causing the issue but I am not that familiar with python and I would say that I am just a beginner at Linux so I am looking to our community for assistance.

Chia Version

(venv) eric@ChiaLinux:~/chia-blockchain$ chia version
1.1.2.dev11

I am running Chia on ubuntu 20.04 desktop. The system seems to be plotting and farming just fine but I know that I need to update the software and this is the first opportunity I have had to try and address this issue. Any assistance on this issue would be greatly appreciated.

1 Like

I have the same issue after updating trying to update to 1.2.5 (it still says 1.2.3.dev0)

Traceback (most recent call last):
  File "/home/jonathan/chia-blockchain/venv/bin/chia", line 33, in <module>
    sys.exit(load_entry_point('chia-blockchain', 'console_scripts', 'chia')())
  File "/home/jonathan/chia-blockchain/chia/cmds/chia.py", line 128, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/jonathan/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/jonathan/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/jonathan/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/jonathan/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jonathan/chia-blockchain/venv/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/jonathan/chia-blockchain/venv/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/jonathan/chia-blockchain/chia/cmds/stop.py", line 46, in stop_cmd
    sys.exit(asyncio.get_event_loop().run_until_complete(async_stop(ctx.obj["root_path"], group, daemon)))
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/jonathan/chia-blockchain/chia/cmds/stop.py", line 12, in async_stop
    daemon = await connect_to_daemon_and_validate(root_path)
  File "/home/jonathan/chia-blockchain/chia/daemon/client.py", line 131, in connect_to_daemon_and_validate
    from chia.server.server import ssl_context_for_client
  File "/home/jonathan/chia-blockchain/chia/server/server.py", line 19, in <module>
    from chia.protocols.shared_protocol import protocol_version
  File "/home/jonathan/chia-blockchain/chia/protocols/shared_protocol.py", line 6, in <module>
    from chia.util.streamable import Streamable, streamable
  File "/home/jonathan/chia-blockchain/chia/util/streamable.py", line 14, in <module>
    from chia.types.blockchain_format.program import Program, SerializedProgram
  File "/home/jonathan/chia-blockchain/chia/types/blockchain_format/program.py", line 10, in <module>
    from clvm_rs import STRICT_MODE, deserialize_and_run_program2, serialized_length, run_generator
ImportError: cannot import name 'run_generator' from 'clvm_rs' (/home/jonathan/chia-blockchain/venv/lib/python3.8/site-packages/clvm_rs.cpython-38-x86_64-linux-gnu.so)

The upgrade process was not working because of problems with some of the libraries. I had to look for the errors that were happening when I tried to update and then delete those libraries using Software & Updates on Ubuntu. Then I could successfully upgrade chia.

Hi! I go for instruction from https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL#ubuntudebian
And I issue thiss commands (in chia venv):
pip install -i https://hosted.chia.net/simple/ miniupnpc==2.1 setproctitle==1.1.10

This does not help, so I continued with:
pip install chia-blockchain==1.2.1

and from now I can use my farmer again and
chia start farmer
works fine.
Hope this helps.
Good luck.