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

Pyrsistent fails to build on 64-bit Raspberry Pi OS in Mycodo virtualenv #1149

Closed
iinewmanii opened this issue Feb 2, 2022 · 20 comments
Closed

Comments

@iinewmanii
Copy link

Describe the problem/bug

During installation I receive an error that pyrsistent has failed to build. The installation will continue afterwards and will fail to connect with the daemon at the end. I have built pyrsistent outside of the install with no problems. I have searched around the github and tried various fixes but nothing helped so i decided to open an issue.

Versions:

  • Mycodo Version: 8.12.9
  • Raspberry Pi Version: 4
  • Raspbian OS Version: 2022-01-28-raspios-bullseye-arm64
  • Python Version: 3.9.2

Reproducibility

Please list specific setup details that are involved and the steps to reproduce the behavior:

It is a fresh install of raspian. All I did afterward was setup wlan and create an ssh file. I the did apt update/upgrade and then started trying to install Mycodo.

Expected behavior

Expect to install without error.

Appreciate any help.

setup.log

@kizniche
Copy link
Owner

kizniche commented Feb 2, 2022

Change the setuptools version in Mycodo/install/requirements.txt to setuptools==60.7.0 and rerun setup.sh to see if it fixes the issue.

@iinewmanii
Copy link
Author

Ok I tried that and I got the same result pyrsistent failed to build again. Could it be the version 0.18.1 of pyrsistent that is causing the problem?

@kizniche
Copy link
Owner

kizniche commented Feb 2, 2022

I just pushed an update that pegs the setuptools version at 60.6.0, which is the previous version. You will need to pull the latest code from master with mv ~/Mycodo ~/Mycodo-bu && git clone https://github.com/kizniche/Mycodo && ~/Mycodo/install/setup.sh

If that doesn't work, change this line:

SETUPTOOLS_VERSION="60.6.0"

And this line:

setuptools==60.6.0

to a previous version found at https://pypi.org/project/setuptools/#history and see if going back to a previous version allows it to install.

I just did a fresh install and am not having the same issue. Also, you neglected to mention the version of raspberry Pi OS, either Lite or Desktop.

@iinewmanii
Copy link
Author

I am using desktop version of 64-bit bullseye raspian.

@iinewmanii
Copy link
Author

I do not have that line in my upgrade_commands.sh file. Do I need to add that?

@kizniche
Copy link
Owner

kizniche commented Feb 2, 2022

I do not have that line in my upgrade_commands.sh file

Then that means you are not using the code on the master branch. The command I mentioned in #1149 (comment) instructs how to clone the Mycodo repo, which will obtain the code in the master branch.

@iinewmanii
Copy link
Author

I got the master branch code after you sent me this message. I tried different versions of setuptools for a while but kept getting the same results. I ended up erasing my sd card and installing the latest 32-bit version of raspberry pi os with desktop and then installing mycodo and didn't have any problems. So maybe it was something with the 64-bit version that was causing an issue. I got it up and running now no problems so I am going to go ahead and start playing with it. Thank you for trying to help me out.

@kizniche
Copy link
Owner

kizniche commented Feb 5, 2022

You're welcome. Glad you figured it out!

@kizniche kizniche closed this as completed Feb 5, 2022
@dylandn
Copy link

dylandn commented Feb 9, 2022

I'm hitting this bug as well, pyrsistent fails to build and mycodoflask.service fails to start. Also on a brand new 64bit install.
I can 'pip install pyrsistent' just fine and that will install pyrsistent, but it fails when trying to install Mycodo.

@kizniche
Copy link
Owner

kizniche commented Feb 9, 2022

Mycodo runs in a virtualenv, so you are not solving the issue by installing a pip package globally. The env is located at ~/Mycodo/env/

@dylandn
Copy link

dylandn commented Feb 9, 2022

Which makes me wonder why it works globally but not in the virtualenv.

@kizniche kizniche reopened this Feb 9, 2022
@kizniche kizniche changed the title Pyrsistent fails to build during install leading to mycodo service not being able to start. Pyrsistent fails to build on 64-bit Raspberry Pi OS in Mycodo virtualenv Feb 9, 2022
@kizniche kizniche added the bug label Feb 9, 2022
@dylandn
Copy link

dylandn commented Feb 9, 2022

Part of the setup.log where it fails:
Building wheel for pyrsistent (pyproject.toml): started
Building wheel for pyrsistent (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error

× Building wheel for pyrsistent (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [78 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.9
copying _pyrsistent_version.py -> build/lib.linux-aarch64-3.9
creating build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_field_common.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_pset.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_helpers.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_checked_types.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_pvector.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/typing.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_pmap.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_precord.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_pbag.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/init.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_immutable.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_pdeque.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_transformations.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_plist.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_toolz.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/_pclass.py -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/py.typed -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/init.pyi -> build/lib.linux-aarch64-3.9/pyrsistent
copying pyrsistent/typing.pyi -> build/lib.linux-aarch64-3.9/pyrsistent
running build_ext
creating build/temp.linux-aarch64-3.9
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/Mycodo/env/include -I/usr/include/python3.9 -c pvectorcmodule.c -o build/temp.linux-aarch64-3.9/pvectorcmodule.o
aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 build/temp.linux-aarch64-3.9/pvectorcmodule.o -L/usr/lib -o build/lib.linux-aarch64-3.9/pvectorc.cpython-39-aarch64-linux-gnu.so
running install
running install_lib
Traceback (most recent call last):
File "/home/pi/Mycodo/env/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in
main()
File "/home/pi/Mycodo/env/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/pi/Mycodo/env/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 216, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
self.run_setup()
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 145, in run_setup
exec(compile(code, file, 'exec'), locals())
File "setup.py", line 53, in
setup(
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 259, in run
self.run_command('install')
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/install.py", line 578, in run
self.run_command(cmd_name)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 985, in run_command
cmd_obj.ensure_finalized()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 17, in finalize_options
self.set_undefined_options('install',('install_layout','install_layout'))
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 290, in set_undefined_options
setattr(self, dst_option, getattr(src_cmd_obj, src_option))
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 103, in getattr
raise AttributeError(attr)
AttributeError: install_layout
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyrsistent
Failed to build pyrsistent
ERROR: Could not build wheels for pyrsistent, which is required to install pyproject.toml-based projects

@kizniche
Copy link
Owner

kizniche commented Feb 9, 2022

Similar error recently at pypa/pip#10857

@kizniche
Copy link
Owner

kizniche commented Mar 16, 2022

I just committed a fix (60993eb) that I can confirm allows install on 64-bit Raspberry Pi OS. If you want to test, make sure you've deleted the current Mycodo directory, then get the latest code from master and install:

git clone https://github.com/kizniche/Mycodo
sudo ~/Mycodo/install/setup.sh

@kizniche
Copy link
Owner

This issue has been mentioned on DIY Automation Forum. There might be relevant details there:

https://forum.kylegabriel.com/t/not-able-to-install-mycodo/782/3

@LeoBosse
Copy link

LeoBosse commented Sep 1, 2022

I had a similar issue with an other packages, and it apparently comes from setuptools. Following this: pypa/setuptools#3278
I tried to run: export SETUPTOOLS_USE_DISTUTILS=stdlib in a terminal, and it worked like a charm!

@kizniche
Copy link
Owner

kizniche commented Sep 2, 2022

What is the purpose? What issue does this resolve?

@LeoBosse
Copy link

LeoBosse commented Nov 8, 2022

I found this thread while looking up my problem, and once I resolved it, I thought I would post my solution here to potentially help somebody with a similar error. I edited my comment with the link that didn't show for the source answer. If you feel that it is misplaced, feel free do remove it.

@TheApeMachine
Copy link

I had a similar issue with an other packages, and it apparently comes from setuptools. Following this: pypa/setuptools#3278 I tried to run: export SETUPTOOLS_USE_DISTUTILS=stdlib in a terminal, and it worked like a charm!

This worked perfectly to solve an error (AttributeError: install_layout. Did you mean: 'install_platlib'?) I was getting while building hnswlib as part of installing some python packages.

@zsc
Copy link

zsc commented Jun 30, 2023

In my case (not about Raspberry Pi but installing ffmpy), I got it work by "python3 -m pip install -U setuptools"

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

No branches or pull requests

6 participants