Python storj sdk doesnt support

hi
I am installing storj in python using storj sdk using “pip install storj”
But I got an error meta-data-generation failed.What is the reason for this issue

Hello @75b7a1e6ae96530a26a1 ,
Welcome to the forum!

Please use this repo for python binding: GitHub - storj-thirdparty/uplink-python: Python bindings for libuplink

I am tried to connect my django project with storj using pythonuplink.But here I got an attribute error
from uplink import AccessGrant
ImportError: cannot import name ‘AccessGrant’ from ‘uplink’ (C:\Users\Dell\Desktop\BeneettaPB(task,tutorial&projects)\uplink\env\Lib\site-packages\uplink_init_.py)
used version of uplink:0.9.7
how to solve this issue?

hi
‘libuplinkc.so’ this file missing and couldnt find even in your source code provided on last conversation

You need to build it locally, if the first option would fail to build libuplinkc.so, then you need to use Option 2.
In both cases you need to install dependencies first.

hi
I am installed the all dependecies.But when I am trying to run ```
go build -o libuplinkc.so -buildmode=c-shared

I got errors:
# storj.io/uplink-c
loadinternal: cannot find runtime/cgo
runtime.main_main·f: function main is undeclared in the main package
how to fix this issue.
1) Already added the path variables and go setup

You need to have golang at least v1.18 installed
Just tried:

git clone -b v1.2.2 https://github.com/storj/uplink-c
cd uplink-c
go build -o libuplinkc.so -buildmode=c-shared

no errors, the library is built to the current directory.

yeah I am using the same version,version 1.20.2

You used Windows, so you need to build a Windows library, not Linux one…
Please set variables:

for cmd.exe

set GOOS="windows"
set GOARCH="amd64"

for PowerShell

$env:GOOS="windows"
$env:GOARCH="amd64"

and try to build again

go build -o libuplinkc.so -buildmode=c-shared
1 Like

hi
I tried with setting up the variables.But again I got the same issue.Actually what was the issue?

The issue that it tries to do a cross-platform build, thus it wants to have a runtime/cgo module enabled.
And since the error have not changed, it’s still trying.

I tried to build uplink-c and have not had any problems.
Windows 11

  1. Installed GO from Download and install - The Go Programming Language
  2. Installed git
winget install Git.Git
  1. Installed Visual Studio Build Tools
winget install  Microsoft.VisualStudio.2022.BuildTools
  1. Installed python from MS Store
  2. Installed TDM-GCC 10.3.0 release | tdm-gcc (jmeubank.github.io)
  3. Installed uplink-python
pip install uplink-python
  1. built libuplinkc.so
git clone -b v1.2.2 https://github.com/storj/uplink-c
cd uplink-c
go build -o libuplinkc.so -buildmode=c-shared
  1. Copied libuplinkc.so to the python310\site-packages\uplink-python (C:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages\uplink_python in my case)

Then updated hello_storj.py from the package with actual API Key, and filename (I used the hello_storj.py file) and successfully run it.

1 Like

I am trying with the given steps in the last conversation.Here I am installing the uplink and all dependecies in ‘venv’ . While running “go build -o libuplinkc.so -buildmode=c-shared” i got
go: GOPATH entry is relative; must be absolute path: “$GOPATH/bin”.
For more details see: ‘go help gopath’
this issue.
I tried to fixing this by setting system environment variable, and add the goroot and gopath in visual studio code.Still I am facing the same problem.

It’s looking for an absolute path. It looks like you’ve set $env:GOPATH="/bin" but you should set it to an absolute path. For example: $env:GOPATH="C:\Users\Michael (Storj)\go"

A stack overflow where someone had a similar issue:

1 Like

I tried built libuplink.so I got an error

# runtime/cgo
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
Here I am reinstalled the 64-bit compiler and after that I got an error

PS C:\Users\DELL\Desktop\beneettastorj\uplink-c> go build -o libuplinkc.so -buildmode=c-shared

storj.io/uplink-c

loadinternal: cannot find runtime/cgo
runtime.main_main·f: function main is undeclared in the main package

Try to uninstall what you have installed and install the same tools as I did - this is checked and it works.
Also perhaps you need to clean temporary downloaded modules before the next try.

I am already tried with what you given.That time I got the same issue cannot find runtime/cgo
Actually the issue is the compiler

I solved the issue by setting cgo enable

2 Likes

This is very weird. I have used these ones:

PS C:\Users\User> winget list Microsoft.VisualStudio.2022.BuildTools
Name                               Id                                     Version Available Source
--------------------------------------------------------------------------------------------------
Visual Studio Build Tools 2022 (2) Microsoft.VisualStudio.2022.BuildTools 17.5.2  17.5.3    winget
  • Python
PS C:\Users\User> python --version
Python 3.10.10

I’m glad that you solved it! However, this is mean, that somewhere the cross-platform compilation is happening, like compile 386 on amd64 platform or Linux binaries on Windows or Windows binaries on Linux.