Python Forum
Visual Studio Code venv ibm_db error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Visual Studio Code venv ibm_db error
#1
Visual Studio Code venv does not allow to pip install ibm_db ( Python 3.7.9)
whereas PyCharm venv allows and then work properlly for the same Python 3.7.9 . Can not figer it out. Somebody know what to do ?
-----------------------Below the terminal info-----------------------------------------------------
Detected 64-bit Python
Db2 installation detected ...
Traceback (most recent call last):
File "c:\roboczy\python37venv\.venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
main()
File "c:\roboczy\python37venv\.venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:\roboczy\python37venv\.venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\zdzis\AppData\Local\Temp\pip-build-env-y_q_1jmh\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "C:\Users\zdzis\AppData\Local\Temp\pip-build-env-y_q_1jmh\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "C:\Users\zdzis\AppData\Local\Temp\pip-build-env-y_q_1jmh\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 129, in <module>
File "<string>", line 91, in _getinstalledDb2Path
IndexError: list index out of range
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Reply
#2
VSCode isn't involved in installing packages. I would open up a shell (not in vscode), activate the venv, and do pip install from the shell. Does it work?

Is the same OS in both cases? Is it the same machine? I've had wheels fail because I didn't have all the required tools installed and all the correct paths defined.
Reply
#3
It is the same machine, the same Windows
Reply
#4
You can open shell within VSCode, but that won't help in this instance.

The problem here, is that the package does not use pip.
It is a driver, and as must be downloaded by clicking on the download link.
Then extracted and installed. Unless you can find a wheel for the package.

PyPi Wrote:https://pypi.org/project/ibm-db/#files->Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
...

see GitHub page here: https://github.com/ibmdb/python-ibmdb
Reply
#5
Does not work. Again the same info on the screen

(.venv) C:\Roboczy\Python37Venv>py -m pip install C:/users/zdzis/Downloads/ibm_db-3.1.3.tar.gz
Reply
#6
Examaple from start make an enviroment and give it name(this make easier to an avoid conflicts).
G:\div_code\answer
λ python -m venv ibm_env

G:\div_code\answer
λ cd ibm_env\

G:\div_code\answer\ibm_env
λ G:\div_code\answer\ibm_env\Scripts\activate

(ibm_env) G:\div_code\answer\ibm_env
λ pip install ibm-db
Collecting ibm-db
  Downloading ibm_db-3.1.3.tar.gz (1.4 MB)
     ---------------------------------------- 1.4/1.4 MB 4.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  ....
Successfully built ibm-db
Installing collected packages: ibm-db
Successfully installed ibm-db-3.1.3
Make file in this folder ibm_test.py
import ibm_db_dbi

print(ibm_db_dbi.Connection)
print(ibm_db_dbi.__version__)
Start Vs Code from this folder(keep envioment active) using code . the it will find virtual enviroment in the list.
[Image: 7ojMLT.png]
Reply
#7
What do you have in environment var paths ? I feel that is the key to that puzzle :)
Reply
#8
(Nov-12-2022, 07:36 PM)mesi1000 Wrote: What do you have in environment var paths ? I feel that is the key to that puzzle :)
No,virtual environment don't use OS environment path at all.
The virtual environment environment variable is only available if the virtual environment is activated.
The point of me doing the the first post was so you could do the same from command line.
I use cmder,but commands is just the same in cmd or PowerShell.

I have Python 3.10 set as OS environment variable.
G:\div_code\answer
λ pip -V
pip 22.3 from C:\python310\lib\site-packages\pip (python 3.10)

G:\div_code\answer
λ where python
C:\python310\python.exe

G:\div_code\answer
λ pip -V
pip 22.3 from C:\python310\lib\site-packages\pip (python 3.10)
If i activate ibm_env it will use the Path in this folde,and environment path is not used.
(ibm_env) G:\div_code\answer\ibm_env
λ python -V
Python 3.10.5

(ibm_env) G:\div_code\answer\ibm_env
λ python -c "import sys; print(sys.executable)"
G:\div_code\answer\ibm_env\Scripts\python.exe

(ibm_env) G:\div_code\answer\ibm_env
λ pip -V
pip 22.0.4 from G:\div_code\answer\ibm_env\lib\site-packages\pip (python 3.10)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  my venv is not loading njoki 1 261 Mar-20-2024, 10:41 AM
Last Post: snippsat
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,050 Nov-15-2023, 06:56 PM
Last Post: jst
  How to set PYTHONPATH in Visual Studio Code? aupres 5 4,237 Aug-15-2023, 03:51 PM
Last Post: snippsat
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 893 Jun-26-2023, 09:40 AM
Last Post: snippsat
  Visual Studio Code NewPi 3 1,061 May-16-2023, 11:13 PM
Last Post: snippsat
  Understanding venv; How do I ensure my python script uses the environment every time? Calab 1 2,289 May-10-2023, 02:13 PM
Last Post: Calab
  Python venv and PIP version issue JanOlvegg 2 1,279 Feb-22-2023, 02:22 AM
Last Post: JanOlvegg
  ibm_db install problem mesi1000 1 3,181 Oct-27-2022, 06:54 PM
Last Post: snippsat
  debugging help on Visual Studio Code mg24 12 2,023 Oct-02-2022, 12:18 AM
Last Post: mg24
  Problem with importing Python file in Visual Studio Code DXav 7 5,117 Jun-15-2022, 12:54 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020