SDK for milkcocoa for python cannot be installed.

Asked 2 years ago, Updated 2 years ago, 96 views

I wanted to transfer the sensor data attached to Raspberry pi3 to milkcocoa. I tried to install python SDK as below, but I got an error.
Please tell me how to resolve it.

https://github.com/milk-cocoa/python_sdk
Download the SDK from for the python of milkcocoa and modify setup.py as follows:

$sudo python3 setup.py install

Yes, but it says Install pip in your computer".
*Pip3 and python3 have been confirmed to exist in where.

OS:Ubuntumate 16.04
Hard—Raspberry PI3B

#!/usr/bin/python3

from__future_import print_function
from setup tools import setup
try:
#    from pip.req import parse_requirements
    from pip3.req import parse_requirements
except ImportError:
    print('Install pip in your computer')
    exit(1)

from milkcocoa import__version__asversion


defget_packages():
    importos

    req_path = os.path.join(os.path.abspath(os.path.dirname(__file__), 'requirements.txt')
    if notos.path.isfile(req_path):
        raise OSError(req_path+'file not found in project directory')

    requirements=parse_requirements(filename=req_path, session=False)
    requirements = [requirement.req.project_name for requirement in requirements]

    return requirements

setup(
    name = 'milkcocoa-python-sdk',
    version=version,
    install_requires=get_packages(),
    packages=['milkcocoa']

python raspberry-pi milkcocoa

2022-09-30 21:17

1 Answers

Now that I've solved it, I'm self-less.

try:
    from pip.req import parse_requirements
#    from pip3.req import parse_requirements

The following error still appeared when I tried.

File "setup.py", line 31, in <module>
    install_requires=get_packages(),
  File "setup.py", line 23, inget_packages
    requirements = [requirement.req.project_name for requirement in requirements]
  File "setup.py", line 23, in <listcomp>
    requirements = [requirement.req.project_name for requirement in requirements]
AttributeError: 'Requirement' object has no attribute' project_name

After a lot of research, the error disappeared with the following two correspondence.

1. Install missing packages
$sudo pip3 install-r requirements.txt

2.Change project_name to name

#requirements=[requirement.req.project_name for requirement in
requirements]
requirements = [requirement.req.name for requirements in requirements  


2022-09-30 21:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.