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

Callable has no attribute __abc_registry #49

Closed
frivas opened this issue Nov 21, 2018 · 9 comments

Comments

Projects
None yet
2 participants
@frivas
Copy link

commented Nov 21, 2018

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Expected Behavior

The SDK provides the possibility of creating a Standard Skill using the StandardSkillBuilder module from ask_sdk.standard.

Current Behavior

When just trying to execute the script I get:

Traceback (most recent call last):
  File "indexClass.py", line 1, in <module>
    from ask_sdk.standard import StandardSkillBuilder
  File "/path/to/ask_sdk/standard.py", line 18, in <module>
    import typing
  File "/path/to/typing.py", line 1356, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/path/to/typing.py", line 1004, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'

Possible Solution

Still investigating. Not sure how to solve this.

Steps to Reproduce (for bugs)

Steps I have followed:

1.- Create a directory to place all my files.
2.- Created the setup.cfg file so pip can install files in that directory (I am using Homebrew this a bug)
3.- Installed the latest available version of the SDK through pip pip install ask-sdk -t .
4.- Created indexClass.py
5.- Imported the needed modules:
from ask_sdk.standard import StandardSkillBuilder
6.- Create the Skill Builder objects
ssb = StandardSkillBuilder(table_name='Preferences', auto_create_table=True)
7.- Added the classes for Launch, Help, Cancel and Stop, All Exceptions and so on.
8.- Added all the requests to the SkillBuilder object
9.- Execute the script python indexClass.py
10.- Uploaded the code to Lambda just to verify that it was not my local environment and got the same error.

You can find details of the code here Book Recommendations

Context

I am trying to create a Lambda function with persistence using DynamoDB however I always start with a basic function to check the basics and moreover now that there is a new SDK version I wanted to test it.

I have also sent the question to the Alexa Developer's Forum
Creating a StandardSkillBuilder with ASK SDK for Python 1.4

Your Environment

  • ASK SDK for Python used: 1.4.0
  • Operating System and version: macOS Mojave
  • VSCode with Python and Alexa plugin

Python version info

  • Python version used for development:
$ python --version
Python 3.7.0

ASK SDK version:

$ pip show ask-sdk
Name: ask-sdk
Version: 1.4.0
Summary: The ASK SDK Standard package provides a full distribution of the SDK, all batteries included, for building Alexa Skills.
Home-page: https://github.com/alexa/alexa-skills-kit-sdk-for-python
Author: Alexa Skills Kit
Author-email: ask-sdk-dynamic@amazon.com
License: Apache 2.0
Location: /Users/fran/Library/Python/3.7/lib/python/site-packages
Requires: ask-sdk-core, ask-sdk-dynamodb-persistence-adapter
Required-by: 

Update: I downgraded to 1.3.0 and used this command:

$ python-lambda-local -f handler indexClass.py tests/LaunchRequest.json

And seems to be working correctly now.

Update # 2:
Updated to ASK SDK 1.4.0 and updated some packages. Would it be possible that some of those are related?

$ pip list -o 
Package             Version   Latest     Type 
------------------- --------- ---------- -----
autopep8            1.4       1.4.3      sdist
aws-sam-cli         0.6.1     0.7.0      sdist
aws-sam-translator  1.7.0     1.8.0      sdist
awscli              1.16.26   1.16.59    wheel
boto3               1.9.6     1.9.49     wheel
botocore            1.12.16   1.12.49    wheel
certifi             2018.8.24 2018.10.15 wheel
click               6.7       7.0        wheel
colorama            0.3.9     0.4.0      wheel
future              0.17.0    0.17.1     sdist
keyring             15.1.0    16.1.0     wheel
MarkupSafe          1.0       1.1.0      wheel
notebook            5.7.0     5.7.2      wheel
python-dateutil     2.7.3     2.7.5      wheel
python-lambda-local 0.1.6     0.1.7      sdist
pytz                2018.6    2018.7     wheel
regex               2018.8.29 2018.11.7  sdist
requests            2.19.1    2.20.1     wheel
rsa                 3.4.2     4.0        wheel
setuptools          40.0.0    40.6.2     wheel
urllib3             1.23      1.24.1     wheel
websocket-client    0.53.0    0.54.0     wheel
wheel               0.31.1    0.32.3     wheel

Seems to be working. I am testing in Lambda now.

Updated # 3: Just tested in Lambda and I am getting the same error as described when opened this case. I will keep investigating.

Thank you very much for taking a look at this

@nikhilym

This comment has been minimized.

Copy link
Contributor

commented Nov 21, 2018

Hey @frivas , thanks for the issue and the updated analysis. This is because of the typing library installed alongside the typing library that comes in the standard python installation. You can check for more details here.

This seems to be a issue on Python 3.7 only, since the same set of packages give no errors on Python 3.6. Can you try downgrading to Python 3.6 and see if you still have the issue? Alternatively, you can uninstall typing module and also try running it through lambda.

@frivas

This comment has been minimized.

Copy link
Author

commented Nov 21, 2018

Hello @nikhilym Thank you very much for your answer. I tried removing typing from my files and it works. Also uploaded the function to Lambda and it worked. I have been reading about the issue at different forums and seems there are only 2 options: as you mentioned downgrading to 3.6 or removing the package. For now I think it is solved. Thank you very much. I will keep an eye on this because seems that is really affecting a lot. Shall I close the issue or you do it?.

@nikhilym

This comment has been minimized.

Copy link
Contributor

commented Nov 21, 2018

Thanks for testing and updating the issue @frivas . I will keep the issue open and make a fix to set the python version in the package requirements.txt, to only download the typing package for < '3.7'.

@frivas

This comment has been minimized.

Copy link
Author

commented Nov 21, 2018

Awesome. Sounds very good. Thank you very much @nikhilym

@nikhilym nikhilym referenced this issue Nov 23, 2018

Merged

Refactor dependencies for python versions #50

5 of 10 tasks complete

@nikhilym nikhilym closed this in #50 Nov 26, 2018

nikhilym added a commit that referenced this issue Nov 26, 2018

Merge pull request #50 from nikhilym/master
Refactor dependencies for python versions. Fixes #49

This commit makes the following changes:

- Set 'typing' package to be installed only on Python 2.7. This fixes the import issue raised in Python 3.7, on using the 'typing 3.6' module, as mentioned in issue #49.
- Remove dependencies on enum34 and typing from extra_requires fields in setup files, since these are installed as dependencies in ask-sdk-model package.
- Set the install_requires dependencies to follow the same version as mentioned in requirements.txt in all ask-sdk* packages.
@nikhilym

This comment has been minimized.

Copy link
Contributor

commented Nov 26, 2018

Hey @frivas , the PR #50 fixes the issue and has been merged. You can expect the fix in the next release.

@frivas

This comment has been minimized.

Copy link
Author

commented Dec 3, 2018

Hello @nikhilym, I just started a new skill from scratch and installed the SDK. For some reason is still installing Typing library. I just did the usual pip install ask-sdk -t . (because when using a brew version of Python for macOS there is a bug) and Typing came with it. Am I missing something?. Probably when you say next release you meant 1.5.0?, if that is the case please ignore my comment and sorry for bothering.

BTW may I kindly ask you if it is possible to know the roadmap of SDK's features to be released?. I guess the roadmap is tied to the features of Alexa however just in case it is possible, does not hurt asking ;)

Thank you very much in advanced again 😄

@nikhilym

This comment has been minimized.

Copy link
Contributor

commented Dec 3, 2018

Hey @frivas , we will be doing an SDK release(1.5.0) this week that should include this feature. Sorry for the delay. I will update the issue once that is done.

As for the SDK features roadmap, I am sorry but we are not allowed to discuss about that in a public forum. You can track either the SDK repo or the developer blogs/forums to know about them. In case you have any feature requests w.r.t the SDK, please raise an issue on the repo or create a user voice post on the developer forums, so that we can know the needs of the community.

@frivas

This comment has been minimized.

Copy link
Author

commented Dec 3, 2018

Hi @nikhilym I totally understand. Thank you very much for the support. 😄 Happy coding!

@nikhilym

This comment has been minimized.

Copy link
Contributor

commented Dec 3, 2018

Hey @frivas , SDK Release 1.5.0 has this code fix. Please update to the latest and let us know if you still face any issues. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.