Giter VIP home page Giter VIP logo

Comments (26)

makermelissa avatar makermelissa commented on August 17, 2024 1

I fixed the script locally on a windows machine with the platform.machine() fix and it worked. Creating a PR now.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024 1

maybe switch to platform.system()?

>>> platform.system()
'Windows'

on WSL ubuntu:

>>> platform.system()
'Linux'

Underneath, platform.system() uses platform.uname().system.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024 1

Sure. I could have a look at PlatformDetect as well.

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

Thanks for letting us know, likely this is caused by #856, and it needs a bit of adjusting. I'll work on a fix right away.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

I just came accross this too. Researching, I found

Adafruit_Blinka/setup.py

Lines 97 to 106 in a1329a8

install_requires=[
"Adafruit-PlatformDetect>=3.70.1",
"Adafruit-PureIO>=1.1.7",
"binho-host-adapter>=0.1.6",
"pyftdi>=0.40.0",
"numpy>=1.21.5",
"adafruit-circuitpython-typing",
]
+ board_reqs
+ platform_reqs,

where platform_reqs is defined beforehand
platform_reqs = []

and then conditionally altered

Adafruit_Blinka/setup.py

Lines 49 to 50 in a1329a8

if sys.platform == "linux" and platform.machine != "mips":
platform_reqs = ["sysv_ipc>=1.1.0"]

git blames 903c5ea as the latest relevant change.

I'm not sure what the exact problem is here. Technically, the condition guarding the dependence on sys-ipc should not be satisfied on Windows

Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun  6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.platform
'win32'
>>> import platform
>>> platform.machine
<function machine at 0x0000023AAE8CB9C0>
>>> platform.machine()
'AMD64'
>>> sys.platform == 'linux' and platform.machine != 'mips'
False

Above you'll observe that platform.machine is a function object, not a static string. So, platform.machine != 'mips' is technically true. But, sys.platform == 'linux' is false.

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

Ah, ok. Yeah, the machine one should probably be updated. However, still strange behavior.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

Strange indeed. Just for clarity, I came here because pip names this lib as the reason for installing sys-ipc:

Collecting sysv-ipc>=1.1.0 (from Adafruit-Blinka->circuitpython-nrf24l01==2.1.3.post1.dev16)

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

I just confirmed that your PR works on Windows using

pip install git+https://github.com/makermelissa/Adafruit_Blinka#main

Thanks!

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

Cool. However, pip install adafruit-blinka is still not working on my system, so I'm going to try and continue tracking down the issue.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

FYI, I used a fresh venv. Not sure if that helps.

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

I might give that a try. I was installing it without a venv.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

Damn, same here. pip cache purge didn't help; v8.44.1 still fails to install.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

I think I have a more understandable flaw. You're using ubuntu-latest in CI to build the bdist. This is understandable since the workflow uses bash's sed to replace version 0.0.0-auto placeholders with the actual tagged version. But sys.platform will always resolve to ``linux'` if your CI runner is a Linux OS.

therefore, us windows users (for v8.44.0 and v8.44.1) have to install without using the bdist:

pip install --no-binary adafruit-blinka adafruit-blinka

Installing collected packages: adafruit-blinka
Successfully installed adafruit-blinka-8.44.1

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

Huh, ok. That kind of makes sense. Well, I may just adjust it to check cpu then. It's only needed for Raspberry Pi and amlogic a311d.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

My lazy gut instinct thinks: For the meantime, just upload the sdist and rely on piwheels to provide the bdist for RPi OS.

It would be nicer if the bdist could be augmented to include the platform tag instead of presuming a universal tag. Maybe cibuildwheel could do that for you, IDK.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

all we really need on windows is a Dependency specifier (see grammar)

sys-ipc>=1.1.0;sys_platform=='linux'

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

all we really need on windows is a Dependency specifier (see grammar)

sys-ipc>=1.1.0;sys_platform=='linux'

Yeah, that would have worked too with the exception of it possibly failing on the mips board. However, using the CPUs for the only boards that need it worked as well. :)

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

IHMO, I still think uploading a universal bdist with so many machine-specific constraints is a flawed approach.

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

Fair enough. I'll update it so it's using the same string as in the requirements.txt from before I changed it.

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

Ci just needs to

python -m build -s

instead of using pypa/build's default behavior

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

Ci just needs to

python -m build -s

instead of using pypa/build's default behavior

What effect will this change have?

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

python -m build does 2 things (by default with no args):

  1. create a sdist (.tar.gz) from the project's current state
  2. create a bdist (.whl) from the sdist created in step 1. This is what you want to skip. Note, this does not actually use the project source. Rather this step is akin to
    python -m pip wheel -w dist --no-deps dist/adafruit-blinka-<major>.<minor>.<patch>.tar.gz
    

python -m build -s will only perform step 1 and skip step 2. More detail https://build.pypa.io/en/stable/ (or in python -m build -h)

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

Python's build back-ends simply aren't made to support creating a platform-specific bdist from a pure python source. There are hacks out there, but there's no guarantee that some new PEP implementation will not break the build process.

I understand the itch to upload bdists because they install faster, but that's why the piwheels project exists. Piwheels also helps with creating 32-bit bdists for c-extensions because we can't use a docker image to reliably create a 32-bit bdist for armv6l platforms. For aarch64, I have to build the bdist (with cibuildwheels) using a qemu VM in CI.

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

It makes sense for Blinka in particular (and possibly PlatformDetect). Want to submit a PR?

from adafruit_blinka.

2bndy5 avatar 2bndy5 commented on August 17, 2024

PlatformDetect doesn't have any install deps (requirements.txt dynamically loaded by build backend from pyproject.toml). Unless I missed something, it looks like all platform-specific code is used at runtime. So, a universal bdist makes sense for that lib.

from adafruit_blinka.

makermelissa avatar makermelissa commented on August 17, 2024

Thanks, makes sense.

from adafruit_blinka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.