Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify Wheel #694

Merged
merged 18 commits into from
Oct 3, 2019
Merged

Verify Wheel #694

merged 18 commits into from
Oct 3, 2019

Conversation

dkeeney
Copy link

@dkeeney dkeeney commented Sep 27, 2019

The intent of the PR is to verify that the wheel package contains the right things.

For #19

@dkeeney
Copy link
Author

dkeeney commented Sep 27, 2019

This is work in progress.
I found that the wheel did not contain the py unit tests. So I set about to copy the unit tests into directory where the wheel package is created (build/Release/distr/src/tests)

This involved:

  • moving setup.py from bindings/py/packaging to the top directory and eliminating the redirection call it was making. So the requirements.txt and the real setup.py are now both at the top of the repository.
  • moving the bindings unit tests (bindings/py/tests) to bindings/py/packaging/src/tests where it could be parallel with htm. Copying bindings/py/packaging/ to the distr folder gets both htm and tests folders with one copy.
  • copy py/tests to the distr folder (merging with the tests from packaging).
  • both copies had to filter out the pycache files.

That is as far as I have gotten so far. The next step is to build it and create the wheel like this for all platforms and see if everything is there in the wheel and that it can be installed using pip directly from the wheel.

Then I need to deal with the linux binary distribution thing.

breznak
breznak previously approved these changes Sep 27, 2019
Copy link
Member

@breznak breznak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks for fixing it! Merge when CI passes.

So the requirements.txt and the real setup.py are now both at the top of the repository.

👍 I think it's good for the (py) packaging to have the standard layout.

Then I need to deal with the linux binary distribution thing.

yep, we'll have to think that out. Is it an issue only on Linux, so OSX,Win wheels would/do already work fine?

@@ -1,33 +1,23 @@

## Layout of directories:
```
Repository
bindings
REPO_DIR external -- cmake scripts to download/build dependancies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, looks like your editor adds weird line ends

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkeeney please fix these

setup.py-old Outdated Show resolved Hide resolved
@breznak
Copy link
Member

breznak commented Sep 27, 2019

@dkeeney
Copy link
Author

dkeeney commented Sep 27, 2019

No, I have lots of work to do on this before it is ready to merge.

@dkeeney
Copy link
Author

dkeeney commented Sep 27, 2019

Working on Windows....

  • I build with python setup.py install --user --force
  • I build the wheel with python setup.py bdist_wheel
  • Use pip to uninstall python -m pip uninstall htm.core
  • Use pip to install from wheel python -m pip install build/Release/distr/dist/htm.core-2.0.14-cp37-cp37m-win_amd64.whl

It says it installs Successfully installed htm.core-2.0.14
but I am getting this error:

ERROR: Error checking for conflicts.
Traceback (most recent call last):
  File "C:\Users\Dave\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3012, in _dep_map
    return self.__dep_map
  File "C:\Users\Dave\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2806, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

I have no idea what might be causing it.

@dkeeney
Copy link
Author

dkeeney commented Sep 27, 2019

Hmmm, I tried to install another unrelated package and got the same error. so maybe its something to do with the way I have python installed....and nothing to do with the wheel.

@breznak
Copy link
Member

breznak commented Sep 27, 2019

Use pip to install from wheel python -m pip install build/Release/distr/dist/htm.core-2.0.14-cp37-cp37m-win_amd64.whl

hey, we could probably test this as a part of the CI steps! The wheel is there, we can just uninstall the source-built library, and try if installing from whl works (+run a few tests)

@breznak
Copy link
Member

breznak commented Sep 27, 2019

@dkeeney I added the CI check that the wheel is installable

@dkeeney
Copy link
Author

dkeeney commented Sep 27, 2019

After re-installing Python 3.7 and removing all other Pythons, I still get this error about conflicts.
But since it did say the install was successful. So I decided to try to install all dependencies as well.

pip install --user --force build/Release/distr/dist/htm.core-2.0.14-cp37-cp37m-win_amd64.whl

It gave me that same error as before. --ignoring that for now.
Then it gave me an error trying to install an egg . The error was cannot find the file specified. and the file was hexy-1.4.3-py3.7.egg
I can see that it downloaded and built the wheel for hexy but perhaps what it is actually doing is installing something else that needs hexy and hexy is not there yet.

Anyway, the point is....this still does not work yet.

@dkeeney
Copy link
Author

dkeeney commented Sep 27, 2019

Also, I cannot figure out how to run the .py unit tests without the full repository being present.
I can get them into the wheel but don't know how to run them.

@dkeeney
Copy link
Author

dkeeney commented Sep 27, 2019

@breznak you added python -m pip install --force build/Release/distr/dist/*.whl to the CI script. On Linux that works but on windows, the * is not expanded.

J:\Projects\AI\htmG>python -m pip install build/Release/distr/dist/*.whl
Requirement 'build/Release/distr/dist/*.whl' looks like a filename, but the file does not exist
*.whl is not a valid wheel filename.

I verified that the wheel does exists.
build/Release/distr/dist/htm.core-2.0.14-cp37-cp37m-win_amd64.whl

@dkeeney
Copy link
Author

dkeeney commented Sep 28, 2019

Traced down the Conflict error. It is a corruption in my site-packages directory caused by an earlier wheel install failure for which pip did not clean up correctly. Anyway, that one we can safely ignore.

@dkeeney
Copy link
Author

dkeeney commented Sep 28, 2019

In your CI script python -m pip install build/Release/distr/dist/*.whl

I added '--force' so that it will also verify that the wheel has the right requirements.txt and that they all can be installed.

That does seem to work here on windows if I expand the '*' before making the call.

@dkeeney
Copy link
Author

dkeeney commented Sep 28, 2019

python -m pytest bindings/py/packaging/tests

If I change this to python -m pytest bindings/py/tests
it does work :-)

@breznak
Copy link
Member

breznak commented Sep 28, 2019

Traced down the Conflict error. It is a corruption in my site-packages directory caused by an earlier wheel install failure for which pip did not clean up correctly. Anyway, that one we can safely ignore.

glad you had it figured. For these reasons, I always use python virtualenv (python -m venv), and if things break, I just rm the whole install.

breznak
breznak previously approved these changes Sep 28, 2019
Copy link
Member

@breznak breznak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad this works with the new changes!

@@ -93,10 +93,12 @@ jobs:
path: build/Release/distr/dist

- name: Test python package is working
shell: bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, this forces windows to act compatible with unixes, right? (is it using the WSL?)

.github/workflows/htmcore.yml Outdated Show resolved Hide resolved
@breznak
Copy link
Member

breznak commented Sep 28, 2019

ls: build/Release/distr/dist/*.whl: No such file or directory

oh, ok, this is an unrelated err.

I've temporarily allowed some steps (that should be run only on tag/release) to run on each PR for debugging. But the creation of the whl is still only on tag.

for debugging this PR
All FIXME should be addressed before merging
Copy link
Member

@breznak breznak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working now for all platforms 👍

Don't merge until the conditional filters for tags are re-enabled.

  • I'll try to add the manylinux building job in this PR

@breznak breznak added the python not py binding, but merge py code in repo label Sep 28, 2019
@breznak
Copy link
Member

breznak commented Sep 28, 2019

Run ls dist/
htm.core-2.0.16-cp37-cp37m-linux_x86_64.whl
htm.core-2.0.16-cp37-cp37m-macosx_10_14_x86_64.whl
htm.core-2.0.16-cp37-cp37m-win_amd64.whl
htm.core-2.0.16-py3.7-linux-x86_64.egg
htm.core-2.0.16-py3.7-macosx-10.14-x86_64.egg
htm.core-2.0.16-py3.7-win-amd64.egg
requirements.txt

why is egg still being created?

@dkeeney
Copy link
Author

dkeeney commented Sep 28, 2019

why is egg still being created?

It occurred to me in my sleep last night. The default for the setup.py setup() function is to generate an egg when we use the keyword install. So when we do python setup.py install --user --force it will create the egg. But if we do
python setup.py bdist_wheel --install --user --force instead to do the build it will generate a wheel as a product of the full build.

I wanted to try this out this morning.

@dkeeney
Copy link
Author

dkeeney commented Sep 28, 2019

python setup.py bdist_wheel --install --user --force

Oh, that should be python setup.py bdist_wheel --user --force

@dkeeney
Copy link
Author

dkeeney commented Sep 28, 2019

Oh, that should be python setup.py bdist_wheel --user --force

Well.... it does not like --user --force, so the overall build command is now python setup.py bdist_wheel
What this will NOT do is install locally. Apparently it is the local install that uses the .egg file.

The CI builds don't need the local egg install if we use the wheel to install.

@dkeeney
Copy link
Author

dkeeney commented Sep 28, 2019

My schedule:
I have some commitments this morning but I can work this after noon and Sunday. But Monday we are traveling to Algodones Mexico for dental work. May be gone 4-5 days.

@breznak
Copy link
Member

breznak commented Sep 28, 2019

It occurred to me in my sleep last night.

wow, nice #️⃣ do you dream of programming and electric sheep? :)

build command is now python setup.py bdist_wheel

I'll try to use this.

@breznak
Copy link
Member

breznak commented Oct 3, 2019

@breznak
Copy link
Member

breznak commented Oct 3, 2019

Everything seems to work! Merging to test PYPI upload with a new tag

@breznak breznak merged commit e6520f3 into master Oct 3, 2019
@breznak breznak deleted the verifywheel branch October 3, 2019 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build in_progress python not py binding, but merge py code in repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants