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

无法下载例程 #7

Closed
hhhhljp opened this issue May 3, 2019 · 11 comments
Closed

无法下载例程 #7

hhhhljp opened this issue May 3, 2019 · 11 comments
Assignees

Comments

@hhhhljp
Copy link

hhhhljp commented May 3, 2019

[ERROR] enum34 must be installed, run pip install enum34
*** [upload] Error 1
我已经安装过enum34了,是安装位置有问题还是什么其他情况吗
编译过程没有问题,例程选择的是kendryte-standalone-sdk的HelloWord

@bitsk
Copy link
Member

bitsk commented May 4, 2019

@ivankravets

How to set up can automatically install kflash dependency package?

@ivankravets
Copy link
Collaborator

You need to pack kflash tool with pre-installed Python packages. See example with https://bintray.com/beta/#/platformio/dl-packages/tool-pulp-debug-bridge?tab=files.
Please download this file tool-pulp-debug-bridge-darwin_x86 and take a look at scripts/build.py.
Lines: 78-107.

So, the core idea is to install dependencies to python/site-packages and later inject them into Python sitedir.

@hhhhljp
Copy link
Author

hhhhljp commented May 4, 2019

The problem has been solved, I made the download location of enum34 wrong, it should be installed in the file directory of pio

@hhhhljp hhhhljp closed this as completed May 4, 2019
@ivankravets ivankravets reopened this May 4, 2019
@ivankravets
Copy link
Collaborator

This is a bug. You no need to install extra packages with PlatformIO. Package should contain all dependencies.

@bitsk
Copy link
Member

bitsk commented May 4, 2019

I saw your example, but I still can't figure out what happened to the package during the installation process. Can I use pip directly during installation? Kflash has been released as a package in pypi, and its setup.py may be able to handle these dependencies.

@ivankravets
Copy link
Collaborator

We don't run python setup.py when installing a package. We just unpack it and move to ~/.platformio/packages folder.
It's not easy to install Python package because it can lead to a lot of issues. There are built-in Python installation in OS, custom virtual environment for PIO Core etc... Each of them has own site-packages storage.

So, keeping package totally independent of pip resolves all issues with local Python installation. Also, it resolves issue with install package without administrative/sudo permissions.

@ivankravets
Copy link
Collaborator

We need to pack enum34 and pyelftool into the package. Could you try to do that?

@bitsk
Copy link
Member

bitsk commented May 5, 2019

I am trying...
I noticed this function,

def install_pysite(dst, packages):
    for package in packages:
        subprocess.call(["pip", "install", "--no-compile", "-t", dst, package])

But I don't know how it is called. Is it executed once in kflash.py every time it runs?

@ivankravets
Copy link
Collaborator

You can run pip install -t from CLI. That script was provided as a hint. You actually don’t need it.

@bitsk
Copy link
Member

bitsk commented May 5, 2019

I used a simple way to get kflash out of dependencies, which can now be run directly.

This may not be a perfect method.
image

        {
            "sha1": "87ef5303917ff2e1fcc7b2bc194f67bd14e5f597",
            "system": "*",
            "url": "http://dl.sipeed.com/MAIX/platformio/dl-packages/tool-kflash-kendryte210-v0.8.2.tar.gz",
            "version": "0.8.2"
        },

@ivankravets
Copy link
Collaborator

@btx000 Thanks! I think we can live with it :)

I've just deployed this package. I've just thought, we can actually can run $PYTHONEXE -m pip install platform.get_package_dir("tool-kflash-kendryte210") before uploading. In this case, we will install kflash dependencies to PIO Core site-packages.

Nevertheless, keeping packages in an isolated environment is a better option.

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

No branches or pull requests

3 participants