Skip to content

Commit b0c77b5

Browse files
authored
Fix for externally-managed-environment Error for setting up Python virtual environment (#227)
python dependency fix
1 parent 94f5660 commit b0c77b5

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

.github/workflows/rpe_test.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ jobs:
3333
if: ${{ matrix.os != 'ubuntu-22.04' }}
3434
uses: actions/setup-node@v4
3535
with:
36-
node-version: 20.11 #if update this then also update in Dockerfile for centos
36+
node-version: 20.11 # if update this then also update in Dockerfile for centos
3737

3838
- name: Setup Python
39-
if: ${{ matrix.os != 'ubuntu-22.04' }}
40-
uses: actions/[email protected]
39+
uses: actions/setup-python@v5
4140
with:
42-
python-version: 3.8 #if update this then also update in Dockerfile for centos
41+
python-version: 3.8 # if update this then also update in Dockerfile for centos
4342

4443
- name: Login to the Container registry
4544
if: ${{ matrix.os == 'ubuntu-22.04' }}
@@ -59,13 +58,13 @@ jobs:
5958
node --version
6059
python3 -V
6160
62-
- name: Shell configuration on centos 7
61+
- name: Shell configuration on CentOS 7
6362
if: ${{ matrix.os == 'ubuntu-22.04' }}
6463
uses: addnab/docker-run-action@v3
6564
with:
6665
shell: bash
6766
image: ghcr.io/${{ github.repository_owner }}/rapid_power_estimator:centos7latest
68-
run:
67+
run: |
6968
source /opt/rh/devtoolset-11/enable
7069
cmake --version
7170
node --version
@@ -82,7 +81,7 @@ jobs:
8281
run: |
8382
npx eslint src/
8483
85-
- name: Install packages centos 7 & Run pytest & frontend test
84+
- name: Install packages CentOS 7 & Run pytest & frontend test
8685
if: ${{ matrix.os == 'ubuntu-22.04' }}
8786
uses: addnab/docker-run-action@v3
8887
with:
@@ -128,13 +127,12 @@ jobs:
128127
if: ${{ matrix.os != 'ubuntu-22.04' }}
129128
uses: actions/setup-node@v4
130129
with:
131-
node-version: 20.11 #if update this then also update in Dockerfile for centos
130+
node-version: 20.11 # if update this then also update in Dockerfile for centos
132131

133132
- name: Setup Python
134-
if: ${{ matrix.os != 'ubuntu-22.04' }}
135-
uses: actions/[email protected]
133+
uses: actions/setup-python@v5
136134
with:
137-
python-version: 3.8 #if update this then also update in Dockerfile for centos
135+
python-version: 3.8 # if update this then also update in Dockerfile for centos
138136

139137
- name: Login to the Container registry
140138
if: ${{ matrix.os == 'ubuntu-22.04' }}
@@ -154,7 +152,7 @@ jobs:
154152
node --version
155153
python3 -V
156154
157-
- name: Shell configuration on centos 7
155+
- name: Shell configuration on CentOS 7
158156
if: ${{ matrix.os == 'ubuntu-22.04' }}
159157
uses: addnab/docker-run-action@v3
160158
with:
@@ -215,14 +213,12 @@ jobs:
215213
name: rapid_power_estimator_${{ matrix.os }}
216214
path: dist/rapid_power_estimator*.exe
217215

218-
219216
- name: Upload Release
220217
if: ${{ matrix.os != 'windows-latest' && contains(github.ref, 'refs/tags/') }}
221218
uses: softprops/action-gh-release@v1
222219
with:
223220
files: dist/rapid_power_estimator*.tar.gz
224221

225-
226222
- name: Upload Release
227223
if: ${{ matrix.os == 'windows-latest' && contains(github.ref, 'refs/tags/') }}
228224
uses: softprops/action-gh-release@v1
@@ -240,13 +236,21 @@ jobs:
240236
- name: Set up Python
241237
uses: actions/setup-python@v5
242238

243-
- name: Install dependencies
244-
run: |
245-
pip install -r requirements.txt
246-
npm install
239+
- name: Set up virtual environment
240+
run: |
241+
python3 -m venv venv
242+
source venv/bin/activate
243+
244+
- name: Install dependencies in virtual environment
245+
run: |
246+
source venv/bin/activate
247+
pip install -r requirements.txt
248+
npm install
247249
248250
- name: Run pytest with Codecov
249-
run: python3 -m pytest --cov=. --cov-report=term-missing
251+
run: |
252+
source venv/bin/activate
253+
python3 -m pytest --cov=. --cov-report=term-missing
250254
251255
- name: Upload results to Codecov
252256
uses: codecov/codecov-action@v4
@@ -261,4 +265,4 @@ jobs:
261265
uses: codecov/codecov-action@v4
262266
with:
263267
token: ${{ secrets.CODECOV_TOKEN }}
264-
slug: os-fpga/rapid_power_estimator
268+
slug: os-fpga/rapid_power_estimator

0 commit comments

Comments
 (0)