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

Clarification request concerning choosenim_install #52

Closed
ConnectedSystems opened this issue Jun 29, 2021 · 4 comments · Fixed by #55
Closed

Clarification request concerning choosenim_install #52

ConnectedSystems opened this issue Jun 29, 2021 · 4 comments · Fixed by #55

Comments

@ConnectedSystems
Copy link

The readme has this example to auto-install the Nim compiler for source distributions, which is nice for providing code to those who don't have Nim installed.

setup(
    ...,                            # Keep your existing arguments
    package_data={'': ['*.nim*']},  # Distribute *.nim & *.nim.cfg source files
    # include_package_data=True,    # <- This line cannot work with package_data
    install_requires=[
        'nimporter',  # Must depend on Nimporter
        'choosenim_install'  # Optional. Auto-installs Nim compiler
    ]
)

However, I cannot seem to get this to work (in a fresh environment without the Nim compiler).

A pip install -e . or python setup.py develop and nimporter build [package name] results in:

FileNotFoundError: [Errno 2] No such file or directory: 'nimble'

This is on both Windows and Linux (Ubuntu).

Am I doing something wrong here?

@juancarlospaco
Copy link
Contributor

@ConnectedSystems

Bugs for choosenim_install should go to choosenim_install repo.

choosenim_install must be installed BEFORE everything else.

How you do that is up to you, but is a precondition,
you can use setup_requires = ["choosenim_install"] or similar,
theres several *_requires that you can use for ordering dependencies,
we did not invent that, thats just how Python is.

@ConnectedSystems
Copy link
Author

Okay sure, but does this mean the example needs to be tweaked? It implies doing as written will work

@juancarlospaco
Copy link
Contributor

No idea, maybe works, but better to use the different *_requires "steps".

@SekouDiaoNlp
Copy link
Collaborator

HI @ConnectedSystems , @juancarlospaco .

It is preferable to list "choosenim_install" in setup_requires rather than install_requires because when installing from source, pip first builds a binary wheel and then installs the package from the generated wheel.

All necessary dependencies to build the package must be listed in setup_requires.
Otherwise, if you specify "choosenim_install" in install_requires, it will only work if the nim compiler is already installed on the system and accessible in PATH.

For example a python package needing "choosenim_install" would have the following:

setup(
    ...,                            # Keep your existing arguments
    package_data={'': ['*.nim*']},  # Distribute *.nim & *.nim.cfg source files
    # include_package_data=True,    # <- This line cannot work with package_data
    setup_requires = [
        "choosenim_install", # Optional. Auto-installs Nim compiler
         ]  
    install_requires=[
        'nimporter',  # Must depend on Nimporter
        ]
)

I will draft a PR to propose to amend the documentation.

SekouDiaoNlp added a commit to SekouDiaoNlp/nimporter that referenced this issue Nov 3, 2021
@Pebaz Pebaz closed this as completed in #55 Nov 5, 2021
Pebaz added a commit that referenced this issue Nov 5, 2021
Fixed Issue with macOS build using 'd:lto' flag + Added support for `*.nim.cfg` and `*.nims` files to specify compiler flags. + Amended the README see #52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants