Installation of uplink_python Dependencies Fails [Windows 10]

Hi, I’m new to this forum. I’ve been following the directions in the Github uplink-python binding readme, because I am trying to install the uplink_python module. The pip installation method appeared to succeed, but failed to accomplish whatever it is that it is supposed to in regards to a file named libuplinkc.so, as I have also seen other users in the forum report, so I tried the manual installation method.

I’m very experienced with Python and some other languages, but I have never touched Go before whatsoever, so I haven’t a slightest clue what the error messages I am receiving mean.

I ran this command from the readme in cmd.exe: go build -o libuplinkc.so -buildmode=c-shared

This was the output (censored to bypass link spam filter):
go build -o libuplinkc.so -buildmode=c-shared
go: downloading storj**[DOT]io/common v0.0.0-20231101115145-09481ec98b57
go: downloading githubj
[DOT]**com/zeebo/errs v1.3.0

storjj**[DOT]**io/uplink-c

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

Hello @ponysrc,
Welcome to the forum!

You need to install several compiler tools:

1 Like

Hi @Alexey , thanks for the detailed instructions. I have managed to install uplink python in pip after following your directions. In my case, I copied libuplinkc.so to C:\Program Files\Python312\Lib\site-packages\uplink_python.

Then I created new CLI access credentials, replaced the satellite and API in hello_storj.py, and in cmd as administrator, attempted to run hello_storj.py. However, I ran into an ImportError because the module name isn’t in the import statements.

Under what context is hello_storj.py supposed to run? I edited the code and added “uplink_python” to the import statements to make them work, but I don’t understand why this was left out of the code, since it isn’t mentioned in your guide…

Also, what is the difference between the “storj” storj · PyPI and “uplink_python” Document modules?

It should work under usual user context, not Administrator. If it cannot import the library, then it is not available either to the user (permissions), or it’s not added to your PATH variable.

Usually you should copy the library not into the system path, but to the packages directory for your python installation.
For my case it’s in the user’s directory, not in a Program Files folder. But I guess it should be ok, if that path in the PATH too.
You may check (cmd):

echo %PATH% | findstr "uplink_python"

The module name actually should be in your import statement as far as I know: uplink-python/uplink_python/hello_storj.py at efba0bc50803599d4570376ad1fd737e0db65b46 · storj-thirdparty/uplink-python · GitHub
but perhaps you need to change the current directory to "C:\Program Files\Python312\Lib\site-packages\uplink_python" and it would be enough, but the file hello_storj.py would be here.

The storj one for the old implementation of the Storj network, and now it should not be used.

The module name actually should be in your import statement

I meant the root module, “uplink_python”. I’ve rewritten my import statements as for example, “from uplink_python.uplink import Uplink”. To me personally, it seems rather unusual to add a module name to the environment variables.

Anyway, I do appreciate the help and direction! I have another unrelated and more open-ended question if you don’t mind me asking. Since the Uplink().request_access_with_passphrase() method requires the encryption passphrase, do you have any personal recommendations for methods for its secure storage? If I just leave it in the code, then it could get compromised, but maybe I shouldn’t worry about that and instead focus on system security.

I would answer like “depends” :slight_smile:
I would use an environment variable and set it only when I would run a program, because it’s an easiest way when you run it in CI/CD pipeline (the value will be provided by a CI/CD system from their encrypted vault). You may also use the vault from Ansible, if you use it.
If that a standalone server, then probably it would be enough if you limit access to the code by the local file system permissions and leave the encryption phrase there… because any local encryption need a key, and you will store it in this way or another on that same server, so doesn’t make sense to use it in this case, because it could be compromised altogether with the server.
Thus in this case I would recommend to store the limited read only access grant instead of the encryption phrase, if it would leak - you may easy revoke it and generate a new one. And since it will be a read only, the hacker cannot do anything harmful with your data, it is public anyway and impossible to destroy.