Score:0

Cannot source venv using makefile

us flag

The Makefile inside project root

# Makefile

.PHONY: help
help:
    @echo "Commands:"
    @echo "venv   : creates development environment."

# Environment
.ONESHELL:
venv:
    python3 -m venv venv
    source venv/bin/activate 

When i run:

make venv

I get the following Error:

$ make venv
python3 -m venv venv
source venv/bin/activate 

/bin/sh: 2: source: not found
Makefile:15: recipe for target 'venv' failed
make: *** [venv] Error 127

However, running the commands outside the Makefile is no problem at all. Any ideas?

Anel Music avatar
us flag
[Makefile default shell is /bin/sh which does not implement source](https://stackoverflow.com/a/43566158/7097493)
hr flag
+1 ... as well, each line in a Makefile is executed in a separate shell iirc. What exactly is your end goal here?
Anel Music avatar
us flag
@steeldriver I changed it in a way that all commands are executed in one single shell. The ultimate goal was to create a virtual environment, source it, pip install setup tools and use the setup.py to install all dependencies
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.