0

Azure ML studio unable to execute this.

Hello,

When I try to execute this,

import sys 
!{sys.executable} -m pip install git+https://{YOUR_GITHUB_LOGIN}:{TOKEN}@github.com/xxxsdk.git@main

I am getting this error.

/bin/bash: {sys.executable}: command not found

But when I only execute this command,

sys.executable

this was the output.

'/anaconda/envs/azureml_py38/bin/python'

I am running this on Azure ML studio. I don't know how to solve the first error about sys.executable. Appreciate your help.

Thanks.

slinger
  • 1
  • 2
  • Instead of using {sys.executable}, try replacing it with the actual path to the Python executable that you obtained from running sys.executable. Your command should look like this: !'/anaconda/envs/azureml_py38/bin/python' -m pip install git+https://{YOUR_GITHUB_LOGIN}:{TOKEN}@github.com/xxxsdk.git@main – Ram Mar 20 '23 at 09:53

1 Answers1

0

It looks like {sys.executable} is not being read properly in your command. Make sure you use the git url by appending PAT token before username like below:-

git+https://<PAT TOKEN>@github.com/<USERNAME>/<REPOSITORY>.git@main

Thanks to Ram-msft, When I tried to enter the entire path of sys.executable and then tried running pip install to install packages from my github it worked.

But when I used pat token before the username in the above format. The command worked successfully without entering entire path only with !{sys.executable}

Code:-

import  sys
sys.executable

Output:-

enter image description here

Code by explicitly mentioning the path:-

import sys 
!'/anaconda/envs/azureml_py310_sdkv2/bin/python' -m pip install git+https://<pat-token>@github.com/<username>/<repository-name>.git@main

Output:-

enter image description here

Code with !{sys.executable}:-

import  sys

!{sys.executable} -m pip install git+https://<PAT TOKEN>@github.com/<USERNAME>/<REPOSITORY>.git@main

Output:-

enter image description here

Also, Make sure you have an appropriate packages in setup.py file in your github account from where you're importing the packages.

my setup.py file :-

from setuptools import setup, find_packages

setup(

name='pycode',

version='0.1',

packages=find_packages(),

install_requires=[

'numpy',

'pandas',

'scikit-learn'

],

entry_points={

'console_scripts': [

'pycode=pycode.cli:main'

]

}

)

SiddheshDesai
  • 3,668
  • 1
  • 2
  • 11