title: How to set-up MLFlow artifact sftp store on a remote Linux machine?
body: <p>My goal is to configure ML Flow to run on a remote Linux server, with logs stored in the PostgreSQL database and artifacts in /home/aw/mlfow/mllogs, where &quot;aw&quot; is my user name with root privileges.</p>
  <p>When I run my simple python code (see section below):</p>
  <ol>
  <li><p>when it's last line (&quot;mlflow.log_artifact(&quot;features.txt&quot;)) is commented out: I get no errors in Python, but when I enter log details via browser, in the artifact section I get the warning: <code>Unable to list artifacts stored undersftp://mlflow_user@194.39.141.27:~/mlflow/mlruns/0/d1eb9ce83b6b4ede96a9ea5203c097da/artifacts</code></p>
  </li>
  <li><p>in case the last line is active, python compiler returns a long list of errors, ending with <code>ValueError: Port could not be cast to integer value as '~'</code>
  I tried running the server from the CLI in many different ways, each time changing the --default-artifact-root parameter (see section below). Interestingly, the printout of the mlflow.get_artifact_uri() variable from the Python code remains the same, despite changes in the CLI server parameters: it always shows up as
  <code>sftp://mlflow_user@94.39.141.27:~/mlflow/mlruns/0/c613c110839946a3adc198377cc82c0c/artifacts</code></p>
  </li>
  </ol>
  <p>So, it looks like there is a problem of setting this parameter up during MLFlow server run from CLI. Maybe it's cached somewhere? Linux server reboot doesn't help.</p>
  <p>Code to reproduce issue
  Server CLI run (credentials are just examples):</p>
  <p>option 1 (based on <a href="https://towardsdatascience.com/setup-mlflow-in-production-d72aecde7fef" rel="nofollow noreferrer">https://towardsdatascience.com/setup-mlflow-in-production-d72aecde7fef</a>):
  <code>mlflow server --backend-store-uri postgresql://mlflow_user:mlflow321@localhost/mlflow_db --default-artifact-root sftp://mlflow_user@194.39.141.27:~/mlflow/mlruns -h 0.0.0.0 -p 8000&amp;</code></p>
  <p>options 2.1 and 2.2 (aw is my user name on the machine, with root privileges):
  <code>mlflow server --backend-store-uri postgresql://mlflow_user:mlflow321@localhost/mlflow_db --default-artifact-root sftp://aw:aw_pass@194.39.141.27:~/mlflow/mlruns -h 0.0.0.0 -p 8000&amp;</code></p>
  <p><code>mlflow server --backend-store-uri postgresql://mlflow_user:mlflow321@localhost/mlflow_db --default-artifact-root sftp://aw:@194.39.141.27:~/home/aw/mlflow/mlruns -h 0.0.0.0 -p 8000&amp;</code></p>
  <p>option 3:
  <code>mlflow server --backend-store-uri postgresql://mlflow_user:mlflow321@localhost/mlflow_db --default-artifact-root sftp://mlflow_user:mlflow_pass#@194.39.141.27:~/mlflow/mlruns -h 0.0.0.0 -p 8000&amp;</code></p>
  <p>Python code:</p>
  <pre><code>import mlflow
  
  if __name__ == &quot;__main__&quot;:
      mlflow.set_tracking_uri(&quot;http://194.39.141.27:8000&quot;) #hostname IP here is just an example
  
      features = &quot;rooms, zipcode, median_price, school_rating, transport&quot;
      with open(&quot;features.txt&quot;, 'w') as f:
          f.write(features)
  
      with mlflow.start_run():
  
          tracking_uri = mlflow.get_tracking_uri()
          artifact_uri = mlflow.get_artifact_uri()
          print(&quot;Tracking uri: {}&quot;.format(tracking_uri))
          print(&quot;Artifact uri: {}&quot;.format(artifact_uri))
  
          mlflow.log_artifact(&quot;features.txt&quot;)
  </code></pre>
  <p>Other info / logs
  Python compiler log:</p>
  <pre><code>File &quot;1.py&quot;, line 18, in
  mlflow.log_artifact(&quot;features.txt&quot;)
  File &quot;/home/aw/anaconda3/lib/python3.8/site-packages/mlflow/tracking/fluent.py&quot;, line 544, in log_artifact
  MlflowClient().log_artifact(run_id, local_path, artifact_path)
  File &quot;/home/aw/anaconda3/lib/python3.8/site-packages/mlflow/tracking/client.py&quot;, line 903, in log_artifact
  self._tracking_client.log_artifact(run_id, local_path, artifact_path)
  File &quot;/home/aw/anaconda3/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/client.py&quot;, line 271, in log_artifact
  artifact_repo = self._get_artifact_repo(run_id)
  File &quot;/home/aw/anaconda3/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/client.py&quot;, line 262, in _get_artifact_repo
  return get_artifact_repository(artifact_uri)
  File &quot;/home/aw/anaconda3/lib/python3.8/site-packages/mlflow/store/artifact/artifact_repository_registry.py&quot;, line 102, in get_artifact_repository
  return _artifact_repository_registry.get_artifact_repository(artifact_uri)
  File &quot;/home/aw/anaconda3/lib/python3.8/site-packages/mlflow/store/artifact/artifact_repository_registry.py&quot;, line 71, in get_artifact_repository
  return repository(artifact_uri)
  File &quot;/home/aw/anaconda3/lib/python3.8/site-packages/mlflow/store/artifact/sftp_artifact_repo.py&quot;, line 32, in init
  &quot;port&quot;: parsed.port,
  File &quot;/home/aw/anaconda3/lib/python3.8/urllib/parse.py&quot;, line 174, in port
  raise ValueError(message) from None
  ValueError: Port could not be cast to integer value as '~'
  </code></pre>
  <p>To conclude: My main goal is to store MLFLow artifacts on a remote Linux server. I would really appreciate any help on how to do this?</p>