semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Python: Bug: Make Install does not work on clean builds

Open Jibola opened this issue 1 year ago • 1 comments

Describe the bug Tried to follow the instructions for DEV SETUP on testing semantic-kernel/python. My device did not have uv installed and, as a result, I was unable to leverage the makefile flow.

We want to use these steps for our own automated testing of the MongoDB library, so being able to follow the instructions is essential to maintain as simple a testing environment as possible.

To Reproduce Steps to reproduce the behavior:

  1. clone the repo
  2. Go to semantic-kernel/python
  3. run make install
make install
uv found
running uv update
make[1]: uv: No such file or directory
make[1]: *** [install-uv] Error 1
make: *** [install] Error 2

Expected behavior

I expected the makefile to execute the curl command: curl -LsSf https://astral.sh/uv/install.sh | sh and proceed with the next steps of installing. This does not work and I keep getting uv not found. After checking, using which uv I confirmed uv did not exist within the same shell instance.

Moreover if I run the curl command myself, I still cannot make it through the remainder of the script as uv is not a recognized command. Ultimately, I ended up installing uv myself and then running the other commands underneath make install sequentially thereafter. I assume this is not desired behavior, though.

Screenshots If applicable, add screenshots to help explain your problem.

Platform

  • OS: [MacOS Sonoma 14.6.1]
  • IDE: [N/A]
  • Language: [Python]
  • Source: [cloned repo]

Additional context Add any other context about the problem here.

Jibola avatar Oct 02 '24 20:10 Jibola

Thanks for reporting, @Jibola. I will have a look at this.

moonbox3 avatar Oct 03 '24 13:10 moonbox3

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Jan 02 '25 02:01 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jan 17 '25 01:01 github-actions[bot]

Re-opening as this work hasn't been validated as complete or not.

moonbox3 avatar Jan 17 '25 02:01 moonbox3

Hi @Jibola, finally getting to look at this. Apologies for the delay.

I've been running make install in a new venv/fresh machine, and I was able to install uv if it didn't exist. The thing that I didn't like, though, is that we forced an exit code 1. I think I'd prefer something like exec $$SHELL so that we instantly reload the shell, without having to force the user to.

Once make install ran and uv exists, I could run something like make install-sk PYTHON_VERSION=3.12 and it installed SK and its dependencies for me.

I'll propose that we change this:

install-uv:
# Check if uv is installed
ifndef UV_VERSION
	echo "uv could not be found"
	echo "Installing uv"
	curl -LsSf https://astral.sh/uv/install.sh | sh
	echo "uv installed"
	echo "Please restart your shell."
	exit 1
else
	echo "uv found $(UV_VERSION)"
	echo "running uv update"
	uv self update 
endif

to:

install-uv:
# Check if uv is installed
ifndef UV_VERSION
	echo "uv could not be found"
	echo "Installing uv"
	curl -LsSf https://astral.sh/uv/install.sh | sh
	echo "uv installed"
	# Re-exec the shell so the newly installed uv is available immediately
        exec $$SHELL
else
	echo "uv found $(UV_VERSION)"
	echo "running uv update"
	uv self update 
endif

moonbox3 avatar Jan 21 '25 02:01 moonbox3

The Makefile was updated even more than this -- please have a look. #10246.

moonbox3 avatar Jan 21 '25 22:01 moonbox3