AIX Open Source

 View Only
  • 1.  pip install option 'no-index'

    Posted Wed March 22, 2023 05:19 PM

    Hi, 

    We are trying to run python pip command with '--no-index' option to avoid our server connecting to internet. But we got 'Invalid requirement' message. Can someone help?

    $ python3 -m pip install  --no-index --find-links=......
    ERROR: Invalid requirement: '--no-index'

    Thanks

    Mi



    ------------------------------
    Mi Wang
    ------------------------------


  • 2.  RE: pip install option 'no-index'

    IBM Champion
    Posted Wed March 22, 2023 06:12 PM
    Are you passing a requirements and/or constraints file?

    -- 
    Stephen L. Ulmer
    Enterprise Architect
    Mainline Information Systems
    (m) 352-870-8649






  • 3.  RE: pip install option 'no-index'

    Posted Thu March 23, 2023 05:42 AM

    You need to pass the <package> argument also. The <package> which needs to be installed. 



    ------------------------------
    Ayappan P
    ------------------------------



  • 4.  RE: pip install option 'no-index'

    Posted Thu March 23, 2023 10:55 AM

    Thank you all for trying to check into this. It's my bad not providing the full command. The following is it:

    python3 -m pip install  --no-index --find-links=/tmp/abcd matplotlib-3.5.1.tar.gz

    By the way, if I want pip to look into AIX Toolbox repository for dependency packages, what should I put as parameter for --find-links option? (we use 'gzip -dc *Toolbox_for_linux_*.tar.gz | tar xf - -C /mnt' to create the repository locally)

    Thanks

    Mi



    ------------------------------
    Mi Wang
    ------------------------------



  • 5.  RE: pip install option 'no-index'

    Posted Thu March 23, 2023 11:04 AM

    To Stephen's question: no, we don't have requirements and/or constraints file.

    Thanks

    Mi



    ------------------------------
    Mi Wang
    ------------------------------



  • 6.  RE: pip install option 'no-index'

    Posted Fri March 24, 2023 10:43 AM

    Hi Ayappan,

    Can you please answer my above questions: 1) Why '--no-index' option not working? 2) if I want pip to look into AIX Toolbox repository for dependency packages, what should I put as parameter for --find-links option?

    I have provided the information for 1) my full python pip command; 2) how we install AIX Toolbox repository.

    Thanks

    Mi



    ------------------------------
    Mi Wang
    ------------------------------



  • 7.  RE: pip install option 'no-index'

    Posted Fri March 24, 2023 11:30 AM

    1) Run like this " python3 -m pip install  --no-index --find-links=/tmp/abcd matplotlib " . No need to give "matplotlib-3.5.1.tar.gz"

    2) You can't use pip to install rpm packages. You need to use rpm command or dnf to install rpm packages. 



    ------------------------------
    Ayappan P
    ------------------------------



  • 8.  RE: pip install option 'no-index'

    IBM Champion
    Posted Fri March 24, 2023 01:46 PM
    Also note that ALL of your (missing) Python dependencies have to be in the directory pointed to by --find-links. You should really be using a requirements file, and doing something like:

    python3 -m pip download --dest=dldir/mystuff --requirements=requirements.txt

    possibly also including --platform= if downloading on a non-AIX system.

    That will download what you need and all of the calculated dependencies, as well as put a requirements file in that directory that has all of the versions specified. You can then install the modules with pip like you are trying to do.

    Depending on your needs, you may also need to use PIP's constraints system.

    Finally, as Ayappan mentioned again, you will install RPMs with the rpm command and Python packages with the pip command/module. There is no tool that coordinates dependencies between these two worlds. Just like RPMs and LPPs are managed separately, so are Python modules. Just because an RPM happens to contain a Python module, doesn't mean that you can install it with PIP - you still need to use RPM on RPMs packages. PIP is yet another package manager, but it only handles Python modules. So you need to install all of the RPMs you want/need first, then try to use PIP to install matplotlib and other not-yet-satisfied Python dependencies. 

    I hope this helped. :)

    -- 
    Stephen L. Ulmer
    Enterprise Architect
    Mainline Information Systems









  • 9.  RE: pip install option 'no-index'

    Posted Fri March 24, 2023 04:52 PM

    Hi Ayappan and Stephen,

    Thanks for your information. Here are the results of my newest efforts. By the way, I have used dnf to install all dependency packages as per this site (https://developer.ibm.com/tutorials/machine-learning-with-python-on-aix/).

    1. Running command 'python3 -m pip install --no-index --find-links=/tmp/new-libs-1 matplotlib'. Somehow pip knows the newest version of matplotlib: 3.7.1. I got the following error. I am wondering if this is due to some dependency check failure? Is "Could not find a version that satisfies the requirement" referring to the version of matplotlib itself or the version of its dependency package?
      Looking in links: /tmp/abcd
      Processing ./matplotlib-3.7.1.tar.gz
        Installing build dependencies ... error
        ERROR: Command errored out with exit status 1:
         command: /opt/freeware/bin/python3 /opt/freeware/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-z2c6j7qt/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links /tmp/new-libs-1 -- 'certifi>=2020.06.20' oldest-supported-numpy 'pybind11>=2.6' 'setuptools_scm>=7'
             cwd: None
        Complete output (3 lines):
        Looking in links: /tmp/new-libs-1
        ERROR: Could not find a version that satisfies the requirement certifi>=2020.06.20 (from versions: none)
        ERROR: No matching distribution found for certifi>=2020.06.20
    2. Running command ''python3 -m pip install --no-index --find-links=/tmp/new-libs-1 matplotlib==3.5.1''
      I found via internet matplotlib 3.5.1 works with python 3.7. But the command running generated following errors. I am wondering why it went to internet giving the fact I have specified no-index option? What did it look for by going to internet? What does "No matching distribution found for setuptools_scm_git_archive" mean? Our server doesn't have internet connection due to security control put on it.
      Looking in links: /tmp/new-libs-1
      Processing ./matplotlib-3.5.1.tar.gz
          ERROR: Command errored out with exit status 1:
           command: /opt/freeware/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lhbt4hte/matplotlib/setup.py'"'"'; __fil   e__='"'"'/tmp/pip-install-lhbt4hte/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"   '\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-2wu1mw98
               cwd: /tmp/pip-install-lhbt4hte/matplotlib/
          Complete output (47 lines):
          WARNING: The wheel package is not available.
          WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError("<pip._vendor.u   rllib3.connection.VerifiedHTTPSConnection object at 0xa00000000ffa488>: Failed to establish a new connection: [Errno 68] Can't assign requested address")'   : /simple/setuptools-scm-git-archive/
      ........
      ERROR: Could not find a version that satisfies the requirement setuptools_scm_git_archive (from versions: none)
          ERROR: No matching distribution found for setuptools_scm_git_archive
          Traceback (most recent call last):
            File "/opt/freeware/lib/python3.7/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
              subprocess.check_call(cmd)
            File "/opt/freeware/lib64/python3.7/subprocess.py", line 363, in check_call
              raise CalledProcessError(retcode, cmd)
          subprocess.CalledProcessError: Command '['/opt/freeware/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tm   p1dc5_5qp', '--quiet', 'setuptools_scm_git_archive']' returned non-zero exit status 1.

    Can you please help on these?

    Thanks

    Mi



    ------------------------------
    Mi Wang
    ------------------------------