0

I'm building a flatpak builded gnome-builder project. Now I want to add scrapy to my project. I use flatpak-pip-generator to generate scrapy package and add it in my manifest like:

"modules": [
  "python3-cryptography",
  "python3-scrapy.json",
  {
    "name": "other-modules"
  }
]

But when I run I get the following error:

Building module python3-cryptography in /home/huydq/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder/build/python3-cryptography-8
========================================================================
Running: pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "cryptography" --no-build-isolation
Using pip 21.2.4 from /usr/lib/python3.9/site-packages/pip (python 3.9)
Looking in links: file:///run/build/python3-cryptography
Processing ./cryptography-36.0.1.tar.gz
    Running command /usr/bin/python3 /usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmplxldpoc4

            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install cryptography:

            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================

    Traceback (most recent call last):
      File "/usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
        main()
      File "/usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 151, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/usr/lib/python3.9/site-packages/setuptools/build_meta.py", line 166, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "/usr/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 14, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'
    Preparing wheel metadata ... error
WARNING: Discarding file:///run/build/python3-cryptography/cryptography-36.0.1.tar.gz. Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmplxldpoc4 Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement cryptography (from versions: 36.0.1)
ERROR: No matching distribution found for cryptography
Error: module python3-cryptography: Child process exited with code 1

And if I add "python3-setuptools_rust" it leads to this error:

ERROR:Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

Any idea to solve this problem? Tks in advance

1 Answers1

1

Have you tried upgrading your pip to the latest, I saw it in your log, maybe give it a try.

Bunny
  • 536
  • 6
  • 18
  • I have another quetstion with using scrapy script in flatpak project. Could u help me pls? – Đỗ Quang Huy Dec 25 '21 at 03:08
  • If the problem is not too big, you can try to comment in here. Or else you can try to create another post with more info about it since the comment section is too small, I'm not really well known to Python, but maybe I can help, if I can't, others sure will help you, too! – Bunny Dec 25 '21 at 03:13
  • Tks a lot @Bunny. I have to wait 90 mins to create another post :v When I can post I will paste the link here. – Đỗ Quang Huy Dec 25 '21 at 03:33
  • here is the new question link: https://stackoverflow.com/questions/70477927/using-scrapy-script-in-flatpak-project – Đỗ Quang Huy Dec 25 '21 at 04:10
  • Hi @Bunny, I just edited my question. When I run the project again it requires cryptography but when I generate cryptography and add, it still get errors. You can check in my edited version – Đỗ Quang Huy Dec 26 '21 at 17:22
  • First, remove the cryptography, then you install it again, and in the requirements.txt just setting your cryptography back to version 2.8, most people fixed this issue with this. You can find more info about it at here: https://stackoverflow.com/questions/59441794/error-could-not-build-wheels-for-cryptography-which-use-pep-517-and-cannot-be-i – Bunny Dec 27 '21 at 01:00
  • I change cryptography version to 2.8 and now I run it got this error ModuleNotFoundError: No module named 'cryptography.hazmat.bindings._constant_time' I tried to find some solutions(https://stackoverflow.com/questions/32518458/importerror-no-module-named-cryptography-hazmat-bindings-openssl) for this but none of those works – Đỗ Quang Huy Dec 27 '21 at 10:29
  • I have another idea of running scrapy script is crawler process which I have a problem to run crawler process with splash? Could you take a look: https://stackoverflow.com/questions/70484804/run-crawlerprocess-in-scrapy-with-splash – Đỗ Quang Huy Dec 27 '21 at 10:33