Dear Synapse users,
I am trying to download some data from www.synapse.org and I cannot find a way to log in trough command line; when I am trying to acces it following this protocol, found here: https://help.synapse.org/docs/Installing-Synapse-API-Clients.1985249668.html:
"
pip install synapseclient
synapse login "username" "password"
synapse -h
"
with username with or withou " (or with ');
I get the error message:
"synapse: error: unrecognized arguments:" which shows my credentials.
I also tried using R to acces the data, with a protocol which seems to work per se, but i have the following error message:
"
Error in value[[3L]](cond) : File download failed during sync
"
Despite the fact that it did start the download.
I must say I find the help / docs / info to use this website quiet tenebrous.
I also tried with Python, but also unsuccessufully...
Many thanks for your kind help
Best
Raphael
Created by raphael guex drrg Hi @drrg ,
Thanks for letting us know. I have filed tickets internally to edit some of our documentation pages to be more clear. Please let us know if you have other questions. Hi @thomas.yu
I believe I made it work with command line, I will repost if I still need help. thanks again for all your help Hi @thomas.yu
Thanks for your help. I tried again today, but again unsuccessfully.
I tried, e.g. with this code:
"
import synapseclient
import synapseutils
syn = synapseclient.Synapse()
syn.login('x','y')
files = synapseutils.syncFromSynapse(syn,'syn22283677')
"
-> and got the following error message:
---------------------------------------------------------------------------------------------------
[WARNING] drrg was defined in the user login arguments, however, it is also defined in the `~/.synapseConfig` file. Becuase they do not match we will not use the `authtoken` in the `~/.synapseConfig` file.
Traceback (most recent call last):
File "G:\tetstI.py", line 4, in
syn.login('x','y')
File "C:\Users\rapha\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
File "C:\Users\rapha\AppData\Local\Programs\Python\Python312\Lib\site-packages\synapseclient\client.py", line 491, in login
raise SynapseNoCredentialsError("No credentials provided.")
synapseclient.core.exceptions.SynapseNoCredentialsError: No credentials provided.
---------------------------------------------------------------------------------------------------
my synapseConfig file looks like this:
"
###########################
# Login Credentials #
###########################
## Used for logging in to Synapse. See https://python-docs.synapse.org/tutorials/authentication/
## for information on retrieving an auth token.
#[authentication]
#username =
#password=
#authtoken =
"
---------------------------------------------------------------------------------------------------
I am starting to despair a bit, I had the impression to follow all the steps of installation, may I have overlooked one step ?
I already tried to reinstall python and R, no changes...
How could I check that my installation is ok ?
Thanks again
Hi @drrg ,
Thanks - apologies for the incovenience. The `~/.synapseConfig` file is found in your home directory, but it is a hidden file. Follow these instructions to see a [hidden file](https://support.microsoft.com/en-us/windows/view-hidden-files-and-folders-in-windows-97fbc472-c603-9d90-91d0-1166d1d9f4b5#:~:text=Show%20%3E%20Hidden%20items.-,Open%20File%20Explorer%20from%20the%20taskbar.,folders%2C%20and%20drives%20and%20OK.).
The synapse config files found in R and Python directories aren't the ones used for authentication.
If that is too cumbersome, you can do the following.
```
import synapseclient
syn = synapseclient.Synapse()
syn.login(authToken="....")
```
It is just less secure if you end up passing this code around. Please let me know if that helps. Hello @thomas.yu
Thanks a lot for all your help.
-Looking for synapseConfig in my PC, I see there is three, 1 in R, two in python : So I edited the three accordingly (with notepad++) : adding my username and authtoken.
-However : in R : when I use the command : synLogin() : I have, again, the same error message : Error in value[[3L]](cond) : No credentials provided.
-I dont think this comand line works : file_entity = synGet('syn22283677') -> I had no error message : but no download (as nothing is downloading in my task manager).
-Error in value [3L] : File download failed during sync : Yes, this was the only error message for this code.
Many thanks again !
-------------------------------------------
I tried with this code :
«
import synapseclient
import synapseutils
syn = synapseclient.login()
synapseutils.syncFromSynapse(syn, "syn22283677", path="G:\x")
«
->And got this error message :
Traceback (most recent call last):
File "G:/tetstE.py", line 3, in
syn = synapseclient.login()
File "C:\Users\rapha\AppData\Local\Programs\Python\Python311\Lib\site-packages\synapseclient\client.py", line 200, in login
syn.login(*args, **kwargs)
File "C:\Users\rapha\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
File "C:\Users\rapha\AppData\Local\Programs\Python\Python311\Lib\site-packages\synapseclient\client.py", line 491, in login
raise SynapseNoCredentialsError("No credentials provided.")
synapseclient.core.exceptions.SynapseNoCredentialsError: No credentials provided.
-> should I also change something in the client.py file ? It seems there is multiple line where to change it correct ?
Thanks again for your help and all explanations.
Best
Hi @drrg ,
Apologies for the multiple notes. Due to the R interface, I recommend using the Python client to bulk-download files, as it will be more robust and will allow you to track the downloads that are happening. Unfortunately `syncFromSynapse` in R doesn't print out the progress. When you do it in Python it looks like this. I would also leverage the `path` parameter to specify where you want the files downloaded. By default, the Synapse Python/R clients will cache the downloads so if a download fails, you can re-run the command and it will only download the files that haven't been downloaded before.
```
import synapseclient
import synapseutils
syn = synapseclient.login()
synapseutils.syncFromSynapse(syn, "syn51549340", path="./")
# Downloading [####################]100.00% 2.9kB/2.9kB (40.1MB/s) ....
# Downloading [####################]100.00%
# Downloaded 32.0MB (3.3MB/s)...
```
Let me know if that helps. Hi @drrg ,
I am starting the download from my end to see if I can replicate your issue. Let's start from the beginning. Will you try this:
1. In your `~/.synapseConfig` file, make sure these lines are included:
```
[authentication]
authtoken=< your personal access token>
```
2. Go to R
```
library(synapser)
synLogin()
file_entity = synGet("syn22332934")
print(file_entity)
```
Please let me know if this works for you. Is that the entire stacktrace?
```
Error in value [3L] : File download failed during sync
```
Hi @thomas.yu
Many thanks for your help!
I am unsure I installed for good this option, as my log in in R did not work without me putting my credentials.
I tried another dataset, and run, again, on the same issue: " Error in value [[3L]](cond) : File download failed during sync"
see please the code R below
-------------------------------------------------------------------------------------------------------------------------------
> library(synapser)
TERMS OF USE NOTICE:
When using Synapse, remember that the terms and conditions of use require that you:
1) Attribute data contributors when discussing these data or results from these data.
2) Not discriminate, identify, or recontact individuals or groups represented by the data.
3) Use and contribute only data de-identified to HIPAA standards.
4) Redistribute data only under these same terms of use.
> library(synapserutils)
Attachement du package : ?synapserutils?
Les objets suivants sont masqués depuis ?package:synapser?:
addPrefix, autoGenerateClasses, autoGenerateEnum,
autoGenerateFunctions, autoGenerateRdFiles, capitalizeFirstLetter,
changeSphinxHyperlinksToLatex, cleanUpStackTrace,
convertSphinxToLatex, createClassRdContent,
createFunctionRdContent, createMethodContent, defineConstructor,
defineEnum, defineFunction, determineArgsAndKwArgs,
formatArgsForArgumentSection, generateRdFiles, generateRWrappers,
getClassInfo, getDescription, getDictDocString, getEnumInfo,
getExample, getFunctionInfo, getReturned, initAutoGenerateRdFiles,
insertLatexNewLines, parseArgDescriptionsFromDetails,
pyVerbiageToLatex, removeNulls, snakeToCamel, usage, writeContent
> synLogin(x,y)
[WARNING] Logging into Synapse via passwords will be deprecated by early 2024. This message will disappear if you use a Synapse Personal Access Token to login.
Welcome, x y!NULL
> files <- synapserutils::syncFromSynapse('syn22324937')
Error in value [[3L]](cond) : File download failed during sync
-------------------------------------------------------------------------------------------------------------------------------
It did start to download I believe however, and I should have right to download these data.
Many thanks again for your help.
Best Hi @raphaelguex ,
Sorry for the trouble! If you are using `~/.synapseConfig` then you don't need to define any parameters in `syn.login`. (This is the same for R) Your commands should look like:
Command line:
```
# the command line should just work without a login if you set up a ~/.synapseConfig
synapse get -r syn51549340
```
R:
```
library(synapser)
synLogin()
```
Python:
```
import synapseclient
import synapseutils
syn = synapseclient.Synapse()
syn.login()
#
files = synapseutils.syncFromSynapse(syn, ' syn51549340 ')
```
Is that the entire stacktrace from R? Let me see if I can reproduce. Please let me know if any of those work.
Hi @thomas.yu
Thanks for your response.
I tried again, with R, as it is the only program which seems to work and only prog with which i am familiar here; with the provided code by your website:
"
library(synapser)
library(synapserutils)
synLogin('x','y')
files <- synapserutils::syncFromSynapse('syn51549340')
"
I still receive the same error code:
"
Error in value[3L] : File download failed during sync
"
I was wondering therefore if this is an appropriate method as it shall I believe feed the "files" with really big dataset: perhaps too big to handle for R ?
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I also tried with the Python version, but the credentials does not work here (despite the fact that they are almost identical code to R): with this code:
import synapseclient
import synapseutils
syn = synapseclient.Synapse()
syn.login('x','y')
files = synapseutils.syncFromSynapse(syn, ' syn51549340 ')
---------------------------
[WARNING] x was defined in the user login arguments, however, it is also defined in the `~/.synapseConfig` file. Becuase they do not match we will not use the `authtoken` in the `~/.synapseConfig` file.
Traceback (most recent call last):
File "G:\tetst.py", line 5, in
syn.login('x','synapse24')
File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\synapseclient\client.py", line 491, in login
raise SynapseNoCredentialsError("No credentials provided.")
synapseclient.core.exceptions.SynapseNoCredentialsError: No credentials provided.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Any ideas are therefore most welcome :)
Raphael
Hi @raphaelguex ,
Thanks for the feedback and apologies for the inconvenience. We can provide a more thorough response on Monday Pacific time, but please try this document site: https://python-docs.synapse.org/. On that page, you should find all the information you need, including installation, authentication, and setting up of the Python client.
After you can log in, please paste the command that is failing so that we can best help you debug on Monday. Thanks in advance for your patience.
Drop files to upload
issue logging in trough command line & use in R page is loading…