Search code examples
pythonsetuptoolssetup.pypython-wheelpython-packaging

Installing from a locally generated wheel does not show update in code


I am installing a package that I have made through creating a bdist_wheel using the command: python3 setup.py sdist bdist_wheel

And then installing the generated wheel using:

pip3 install dist/todx-0.0.4-py3-none-any.whl

But When I run the command todx I get this error:

Traceback (most recent call last):
  File "/home/xypnox/.local/bin/todx", line 7, in <module>
    from todx.main import main_command
  File "/home/xypnox/.local/lib/python3.6/site-packages/todx/__init__.py", line 4, in <module>
    from todx import main
  File "/home/xypnox/.local/lib/python3.6/site-packages/todx/main.py", line 7, in <module>
    from todx import fabric
  File "/home/xypnox/.local/lib/python3.6/site-packages/todx/fabric/__init__.py", line 1, in <module>
    import settings
ModuleNotFoundError: No module named 'settings'

However as you can confirm from my repository: https://github.com/xypnox/todxpy/blob/master/todx/fabric.py , I have changed the file containing the erroneous import. I however cannot reflect this change in the wheel that is built.

What works:

pip3 install -e . successfully installs the package in my computer but the wheel built doesn't reflect the code changes. I cannot hence upload the newer code to the pypi.

What I have tried:

I have tried the following to no avail:

  • pip3 uninstall todx
  • python3 setup.py clean
  • rm -r build/* dist/*

Update:

I have tried --upgrade with pip3 install but it doesn't solve the problem that the updates in my file are not reflected in the generated wheel - pip3 install --upgrade dist/todx-0.0.4-py3-none-any.whl doesn't work


Solution

  • Try using pip3 install --upgrade dist/todx-0.0.4-py3-none-any.whl.

    If a package is already installed and you want to upgrade it, you need to use the upgrade flag. Otherwise, it will not be changed. However, it's weird that it didn't work after you had removed it. Maybe pip had it cached.