pacparser icon indicating copy to clipboard operation
pacparser copied to clipboard

`pip install pacparser` doesn't work

Open QuAzI opened this issue 4 months ago • 7 comments

> python -m pip install pacparser
Collecting pacparser
  Downloading pacparser-1.4.5.tar.gz (5.3 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/7a/ce/2ffcef5537d7f5c7b04a281852612f4419707c665ef0caffb90c8d351fc2/pacparser-1.4.5.tar.gz (from https://pypi.org/simple/pacparser/): Requested pacparser from https://files.pythonhosted.org/packages/7a/ce/2ffcef5537d7f5c7b04a281852612f4419707c665ef0caffb90c8d351fc2/pacparser-1.4.5.tar.gz has inconsistent version: expected '1.4.5', but metadata has '1.0.0'
  Downloading pacparser-1.4.4.tar.gz (5.3 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/44/5a/de59d93bc1c017ab829bd6115b4abff13552b7c90a90ddf303d96d9db868/pacparser-1.4.4.tar.gz (from https://pypi.org/simple/pacparser/): Requested pacparser from https://files.pythonhosted.org/packages/44/5a/de59d93bc1c017ab829bd6115b4abff13552b7c90a90ddf303d96d9db868/pacparser-1.4.4.tar.gz has inconsistent version: expected '1.4.4', but metadata has '1.0.0'
  Downloading pacparser-1.4.3.tar.gz (5.3 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/57/85/ead715e3eca6fb97a50948acef97f859f8a259f0bc93f9b8a3895b90d2fd/pacparser-1.4.3.tar.gz (from https://pypi.org/simple/pacparser/): Requested pacparser from https://files.pythonhosted.org/packages/57/85/ead715e3eca6fb97a50948acef97f859f8a259f0bc93f9b8a3895b90d2fd/pacparser-1.4.3.tar.gz has inconsistent version: expected '1.4.3', but metadata has '1.0.0'
  Downloading pacparser-1.4.2.tar.gz (5.2 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/00/dc/69d2c0e17afbfe67173dc3d1ca52c7f8267712fb4bb62c0af3d457a96a6c/pacparser-1.4.2.tar.gz (from https://pypi.org/simple/pacparser/): Requested pacparser from https://files.pythonhosted.org/packages/00/dc/69d2c0e17afbfe67173dc3d1ca52c7f8267712fb4bb62c0af3d457a96a6c/pacparser-1.4.2.tar.gz has inconsistent version: expected '1.4.2', but metadata has '1.0.0'
  Downloading pacparser-1.4.1.tar.gz (5.2 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/ad/10/45fddc52d385c1b6675d92be1b59f77fa4f5c0679e065ed86f2d2b420e7f/pacparser-1.4.1.tar.gz (from https://pypi.org/simple/pacparser/): Requested pacparser from https://files.pythonhosted.org/packages/ad/10/45fddc52d385c1b6675d92be1b59f77fa4f5c0679e065ed86f2d2b420e7f/pacparser-1.4.1.tar.gz has inconsistent version: expected '1.4.1', but metadata has '1.0.0'
  Downloading pacparser-1.4.0.tar.gz (5.2 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/f4/e3/a4ab7a5abdf569bb55095cd3c0e9402e85d12adfebca724daf41009b9c1f/pacparser-1.4.0.tar.gz (from https://pypi.org/simple/pacparser/): Requested pacparser from https://files.pythonhosted.org/packages/f4/e3/a4ab7a5abdf569bb55095cd3c0e9402e85d12adfebca724daf41009b9c1f/pacparser-1.4.0.tar.gz has inconsistent version: expected '1.4.0', but metadata has '1.0.0'
  Downloading pacparser-1.3.9.tar.gz (5.2 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/68/72/4ffa8575893c3a28d63709de5aa30b41d8e8ccb977c31d416455b5721101/pacparser-1.3.9.tar.gz (from https://pypi.org/simple/pacparser/): Requested pacparser from https://files.pythonhosted.org/packages/68/72/4ffa8575893c3a28d63709de5aa30b41d8e8ccb977c31d416455b5721101/pacparser-1.3.9.tar.gz has inconsistent version: expected '1.3.9', but metadata has '1.0.0'
  Downloading pacparser-1.3.7.tar.gz (4.0 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      <string>:39: SyntaxWarning: invalid escape sequence '\w'
      'make' is not recognized as an internal or external command,
      operable program or batch file.
      Traceback (most recent call last):
        File "D:\Projects\pacparser\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "D:\Projects\pacparser\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\Projects\pacparser\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 175, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "C:\Users\rusla\AppData\Local\Temp\pip-build-env-bbzapbj_\overlay\Lib\site-packages\setuptools\build_meta.py", line 376, in prepare_metadata_for_build_wheel
          self._bubble_up_info_directory(metadata_directory, ".egg-info")
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\rusla\AppData\Local\Temp\pip-build-env-bbzapbj_\overlay\Lib\site-packages\setuptools\build_meta.py", line 345, in _bubble_up_info_directory
          info_dir = self._find_info_directory(metadata_directory, suffix)
        File "C:\Users\rusla\AppData\Local\Temp\pip-build-env-bbzapbj_\overlay\Lib\site-packages\setuptools\build_meta.py", line 356, in _find_info_directory
          assert len(candidates) == 1, f"Multiple {suffix} directories found"
                 ^^^^^^^^^^^^^^^^^^^^
      AssertionError: Multiple .egg-info directories found
      [end of output]

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

[notice] A new release of pip is available: 25.2 -> 25.3
[notice] To update, run: python.exe -m pip install --upgrade pip
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details

QuAzI avatar Nov 01 '25 14:11 QuAzI

Looks like it was on Windows. For windows we upload binaries to pypi: https://pypi.org/project/pacparser/#files

Which python version and platform it was?

manugarg avatar Nov 01 '25 22:11 manugarg

If it as python 3.13, https://github.com/manugarg/pacparser/pull/221 should take care of it.

manugarg avatar Nov 01 '25 23:11 manugarg

@QuAzI Added python 3.14 as well. Can you please retry.

manugarg avatar Nov 02 '25 06:11 manugarg

Windows 10 (22H2), Python 3.13.9

If it so depends on platform, it would be nice to add a platforms block into README.md like

## Install

### Linux

### MacOS

### Windows

Use pacparser.exe, Luke!

because currently it looks like everybody can use pip

Image

At all, README.md not actual at the moment. For example, this example requires parameter -p before file

manugarg@hobbiton:~$ ./pactest wpad.dat http://www.google.com www.google.com

It would be nice to have an ability to use a remote url there

pacparser.parse_pac('examples/wpad.dat')

For example, I have an http://wpad.wpad.dat in my LAN and it would be prettier to test it directly, without downloading each time.

QuAzI avatar Nov 02 '25 06:11 QuAzI

Sorry I didn't follow from your response. Does pip install work now?

manugarg avatar Nov 02 '25 07:11 manugarg

Sorry, I started to write the previous message before you answered about pip. Now pip install works as expected, at least for Python 3.13.9.

But I don't understand what is wrong with my file

> python .\test.py
JSERROR: PAC script:4:
    SyntaxError: illegal character
pacparser.c: pacparser_parse_pac_string: Failed to evaluate the pac script.
Traceback (most recent call last):
  File "D:\Projects\pacparser\test.py", line 4, in <module>
    pacparser.parse_pac('wpad.js')
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "D:\Projects\pacparser\.venv\Lib\site-packages\pacparser\__init__.py", line 53, in parse_pac
    parse_pac_file(pacfile)
    ~~~~~~~~~~~~~~^^^^^^^^^
  File "D:\Projects\pacparser\.venv\Lib\site-packages\pacparser\__init__.py", line 63, in parse_pac_file
    _pacparser.parse_pac_string(pac_script)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
pacparser.error: Could not parse pac script string

Almost the sample

import pacparser

pacparser.init()
pacparser.parse_pac('wpad.js')
pacparser.find_proxy('https://www.google.com', 'www.google.com')
pacparser.setmyip("192.168.1.134")
pacparser.find_proxy('https://www.jetbrains.com', 'www.jetbrains.com')
pacparser.cleanup()

wpad.js

VSCode and eslint --no-config-lookup wpad.js don't highlight any problems

QuAzI avatar Nov 02 '25 07:11 QuAzI

Let's file another issue for that.

Though I think in your case problem is in the alert statement, and reference to variables in template style. I don't believe JS interpreter in pacparser supports that.

alert(`Direct: ${host}`);

https://github.com/manugarg/pacparser/issues/32 talks about similar limitation.

manugarg avatar Nov 02 '25 19:11 manugarg