Как установить модули NLTK, когда приложение pu sh использует IBM Cloud Foun dry CLI? - PullRequest
0 голосов
/ 16 января 2020

Моему приложению требуются некоторые корпуса, я добавил файл nltk.txt в root приложения, содержащего имя корпуса в строке. Например:

punkt stopwords words

Я изучаю этот урок https://docs.cloudfoundry.org/buildpacks/python/index.html

Я получил эту ОШИБКУ:

      [nltk_data] Downloading package punkt to
      [nltk_data]     /tmp/contents366447734/deps/0/python/nltk_data...
      [nltk_data]   Unzipping tokenizers/punkt.zip.
      [nltk_data] Error loading : Package '' not found in index

Журналы:

        C:\Users\action>ibmcloud cf push myapp.zip
        Chamando 'cf push myapp.zip'...

        Pushing from manifest to org My Org / space My space as myemail@email.com...
        Using manifest file C:\Users\action\manifest.yml
        Deprecation warning: Use of 'buildpack' attribute in manifest is deprecated in favor of 'buildpacks'. Please see http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#deprecated for alternatives and other app manifest deprecations. This feature will be removed in the future.

        Getting app info...
        Updating app with these attributes...
          name:                myapp.zip
          path:                C:\Users\action
          buildpacks:
            https://github.com/cloudfoundry/buildpack-python.git
          disk quota:          1G
          health check type:   port
          instances:           1
          memory:              1G
          stack:               cflinuxfs3
          routes:
            myappzip.mybluemix.net

        Updating app myapp.zip...
        Mapping routes...
        Comparing local files to remote cache...
        Packaging files to upload...
        Uploading files...
         5.55 MiB / 5.55 MiB [============================================================================================================================================] 100.00% 3s

        Waiting for API to complete processing files...

        Staging app and tracing logs...
           Cell ed6fe0d3-9893-42ed-b611-06d12135ba25 creating container for instance 3c883485-e964-4e8f-8b29-f7d268bfb723
           Cell ed6fe0d3-9893-42ed-b611-06d12135ba25 successfully created container for instance 3c883485-e964-4e8f-8b29-f7d268bfb723
           Downloading app package...
           Downloading build artifacts cache...
           Downloaded app package (14.1M)
           Downloaded build artifacts cache (52.8M)
           -----> Download go 1.12.4
           -----> Running go build supply
           /tmp/buildpackdownloads/475f64b334d26075d1b844f33141ed40 ~
           ~
           -----> Python Buildpack version 1.7.5
           -----> Supplying Python
           -----> Installing python 3.7.6
                  Copy [/tmp/cache/final/dependencies/7393906197d72cb5ea4466de1918f2f4b789a4ed88be123e8246b7623236626b/python-3.7.6-linux-x64-cflinuxfs3-bb141b1e.tgz]
           -----> Installing pip-pop 0.1.4
                  Copy [/tmp/cache/final/dependencies/3b86fb2cd9c13268f8858fd0ccb2f9eaf11295a51804b7075fe38d7e2a471191/pip-pop-0.1.4-0a3b0f1b.tar.gz]
           -----> Running Pip Install
                  Collecting requests==2.22.0 (from -r /tmp/app/requirements.txt (line 1))
                    Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
                  Collecting urllib3==1.25.7 (from -r /tmp/app/requirements.txt (line 2))
                    Using cached https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl
                  Collecting nltk==3.4.5 (from -r /tmp/app/requirements.txt (line 3))
                    Using cached https://files.pythonhosted.org/packages/f6/1d/d925cfb4f324ede997f6d47bea4d9babba51b49e87a767c170b77005889d/nltk-3.4.5.zip
                  Collecting chardet<3.1.0,>=3.0.2 (from requests==2.22.0->-r /tmp/app/requirements.txt (line 1))
                    Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
                  Collecting certifi>=2017.4.17 (from requests==2.22.0->-r /tmp/app/requirements.txt (line 1))
                    Using cached https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl
                  Collecting idna<2.9,>=2.5 (from requests==2.22.0->-r /tmp/app/requirements.txt (line 1))
                    Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
                  Collecting six (from nltk==3.4.5->-r /tmp/app/requirements.txt (line 3))
                    Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
                  Installing collected packages: chardet, urllib3, certifi, idna, requests, six, nltk
                    WARNING: The script chardetect is installed in '/tmp/contents366447734/deps/0/python/bin' which is not on PATH.
                    Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
                    Running setup.py install for nltk: started
                      Running setup.py install for nltk: finished with status 'done'
                  Successfully installed certifi-2019.11.28 chardet-3.0.4 idna-2.8 nltk-3.4.5 requests-2.22.0 six-1.14.0 urllib3-1.25.7
                  WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
                  You should consider upgrading via the 'pip install --upgrade pip' command.
           -----> Downloading NLTK corpora...
           -----> Downloading NLTK packages: punkt  stopwords  words
                  /tmp/contents366447734/deps/0/python/lib/python3.7/runpy.py:125: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour
                    warn(RuntimeWarning(msg))
                  [nltk_data] Downloading package punkt to
                  [nltk_data]     /tmp/contents366447734/deps/0/python/nltk_data...
                  [nltk_data]   Unzipping tokenizers/punkt.zip.
                  [nltk_data] Error loading : Package '' not found in index
                  Error installing package. Retry? [n/y/e]
                  Traceback (most recent call last):
                    File "/tmp/contents366447734/deps/0/python/lib/python3.7/runpy.py", line 193, in _run_module_as_main
                      "__main__", mod_spec)
                    File "/tmp/contents366447734/deps/0/python/lib/python3.7/runpy.py", line 85, in _run_code
                      exec(code, run_globals)
                    File "/tmp/contents366447734/deps/0/python/lib/python3.7/site-packages/nltk/downloader.py", line 2549, in <module>
                      halt_on_error=options.halt_on_error,
                    File "/tmp/contents366447734/deps/0/python/lib/python3.7/site-packages/nltk/downloader.py", line 798, in download
                      choice = input().strip()
                  EOFError: EOF when reading a line
                  **ERROR** Could not download NLTK Corpora: exit status 1
           Failed to compile droplet: Failed to run all supply scripts: exit status 14
           Exit status 223
           Cell ed6fe0d3-9893-42ed-b611-06d12135ba25 stopping instance 3c883485-e964-4e8f-8b29-f7d268bfb723
           Cell ed6fe0d3-9893-42ed-b611-06d12135ba25 destroying container for instance 3c883485-e964-4e8f-8b29-f7d268bfb723
           Cell ed6fe0d3-9893-42ed-b611-06d12135ba25 successfully destroyed container for instance 3c883485-e964-4e8f-8b29-f7d268bfb723
        Error staging application: App staging failed in the buildpack compile phase
        FAILED

Спасибо за помощь

...