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

Can't build (react issue) #1

Open
kiyoon opened this issue Mar 25, 2023 · 15 comments
Open

Can't build (react issue) #1

kiyoon opened this issue Mar 25, 2023 · 15 comments

Comments

@kiyoon
Copy link

kiyoon commented Mar 25, 2023

Hi, this repo really is a good starting point to understand basics. Thanks a lot for sharing!

I have an issue with building the extension.

pip install -e . fails with

      subprocess.CalledProcessError: Command '['/home/kiyoon/.local/bin/jlpm', 'install']' returned non-zero exit status 1.

If I try jlpm build, it says

Internal Error: nbactions@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
    at P0.getCandidates (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:435:5145)
    at yf.getCandidates (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:391:1264)
    at /home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:439:7693
    at of (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:390:11070)
    at ge (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:439:7673)

I tried with jlpm install and jlpm build again, then I get

.yarn/cache/@jupyterlab-cells-npm-3.6.2-1d2a1702bd-5827fa310a.zip/node_modules/@jupyterlab/cells/lib/collapser.d.ts:2:24 - error TS7016: Could not find a declaration file for module 'react'. '/home/kiyoon/bin/nbactions/.yarn/cache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js' implicitly has an 'any' type.
  If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react`

2 import * as React from 'react';
                         ~~~~~~~

.yarn/cache/@jupyterlab-cells-npm-3.6.2-1d2a1702bd-5827fa310a.zip/node_modules/@jupyterlab/cells/lib/placeholder.d.ts:1:24 - error TS7016: Could not find a declaration file for module 'react'. '/home/kiyoon/bin/nbactions/.yarn/cache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js' implicitly has an 'any' type.
  If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react`

1 import * as React from 'react';
                         ~~~~~~~

.yarn/cache/@jupyterlab-notebook-npm-3.6.2-2183254c3c-d44476cfc0.zip/node_modules/@jupyterlab/notebook/lib/default-toolbar.d.ts:5:24 - error TS7016: Could not find a declaration file for module 'react'. '/home/kiyoon/bin/nbactions/.yarn/cache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js' implicitly has an 'any' type.
  If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react`

5 import * as React from 'react';
                         ~~~~~~~

.yarn/cache/@jupyterlab-notebook-npm-3.6.2-2183254c3c-d44476cfc0.zip/node_modules/@jupyterlab/notebook/lib/executionindicator.d.ts:3:19 - error TS7016: Could not find a declaration file for module 'react'. '/home/kiyoon/bin/nbactions/.yarn/cache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js' implicitly has an 'any' type.
  If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react`

3 import React from 'react';
                    ~~~~~~~

.yarn/cache/@jupyterlab-notebook-npm-3.6.2-2183254c3c-d44476cfc0.zip/node_modules/@jupyterlab/notebook/lib/modestatus.d.ts:1:23 - error TS2688: Cannot find type definition file for 'react'.

1 /// <reference types="react" />
                        ~~~~~

.yarn/cache/@jupyterlab-notebook-npm-3.6.2-2183254c3c-d44476cfc0.zip/node_modules/@jupyterlab/notebook/lib/truststatus.d.ts:1:23 - error TS2688: Cannot find type definition file for 'react'.

1 /// <reference types="react" />
                        ~~~~~

.yarn/cache/y-protocols-npm-1.0.5-af6f64b4df-d19404a4eb.zip/node_modules/y-protocols/awareness.d.ts:85:20 - error TS2307: Cannot find module 'yjs' or its corresponding type declarations.

85 import * as Y from "yjs";
                      ~~~~~

I have NodeJS installed. I also tried npm install -g react but had no luck.

What else am I missing? Thanks for looking into this!

@onukwilip
Copy link

From what i can read here

Internal Error: nbactions@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
   at P0.getCandidates (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:435:5145)
   at yf.getCandidates (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:391:1264)
   at /home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:439:7693
   at of (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:390:11070)
   at ge (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:439:7673)

and here

Internal Error: nbactions@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
    at P0.getCandidates (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:435:5145)
    at yf.getCandidates (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:391:1264)
    at /home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:439:7693
    at of (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:390:11070)
    at ge (/home/kiyoon/.local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:439:7673)

make sure that the pip and jlpm libraries are installed in the node_modules folder. Also instead of just calling and jlpm build try npx jplm build.

Hope this helps

@onukwilip
Copy link

It also seems like you are using yarn as your package manager. You shouldn't use yarn as your package manager and npm at the same time, you should pick one. Try running yarn install and see where that helps.

@kiyoon
Copy link
Author

kiyoon commented Mar 31, 2023

@onukwilip Thanks a lot! It really helped a lot. I'm very new to the web development.

I don't know how I installed yarn but I think it's because one of the programs I use required it.

I had to run npm install and it will create node_modules folder. From here, running npx jlpm build will use the correct version of jlpm installed through npm, not from the pip.

@kiyoon
Copy link
Author

kiyoon commented Mar 31, 2023

However, now I have an issue with pip install -e .

Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/kiyoon/project/nbactions
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      Traceback (most recent call last):
        File "/home/kiyoon/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 167, in prepare_metadata_for_build_editable
          hook = backend.prepare_metadata_for_build_editable
      AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/home/kiyoon/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/kiyoon/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/kiyoon/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatchling/build.py", line 78, in build_editable
          return os.path.basename(next(builder.build(wheel_directory, ['editable'])))
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatchling/builders/plugin/interface.py", line 93, in build
          self.metadata.validate_fields()
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatchling/metadata/core.py", line 243, in validate_fields
          _ = self.version
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatchling/metadata/core.py", line 128, in version
          self._version = self._get_version()
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatchling/metadata/core.py", line 222, in _get_version
          core_metadata = self.core
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatchling/metadata/core.py", line 174, in core
          metadata_hook.update(self.core_raw_metadata)
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatch_nodejs_version/metadata_source.py", line 176, in update
          authors = [self._parse_person(package["author"])]
        File "/tmp/pip-build-env-o05rawqj/overlay/local/lib/python3.10/dist-packages/hatch_nodejs_version/metadata_source.py", line 140, in _parse_person
          if {"url", "email"} & person.keys():
      AttributeError: 'str' object has no attribute 'keys'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with 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.

It looks like the hatch-nodejs-version package has some bug, but I don't know this well enough to tell if it's a bug or my misconfiguration.

@kiyoon
Copy link
Author

kiyoon commented Mar 31, 2023

I think maybe I don't need to do pip install -e .. I followed the ui-tests/, and with jlpm playwright test --headed I saw some browser and although test hasn't passed it is still a great progress.

I wonder if there's any way to use galata in Python. My plugin is already written in Python and users are mostly Python users, so it would be nice if I could keep my code in Python and encourage contribution.

@onukwilip
Copy link

Why are you using pip?

@kiyoon
Copy link
Author

kiyoon commented Mar 31, 2023

I don't know. This repo's readme says I need to install python dependencies

@kiyoon
Copy link
Author

kiyoon commented Mar 31, 2023

I think it's for building everything into a python package so you can distribute and install without nodejs installed (maybe)

@onukwilip
Copy link

I don't think I've ever heard about that before. Can you please send me the link of the repo documentation, e.g. Readme?

@onukwilip
Copy link

As a new developer, you are not meant to use libraries you know nothing about or are unfamiliar with, it will introduce bugs to your code, just like this one

@kiyoon
Copy link
Author

kiyoon commented Mar 31, 2023

Oh it's just this repo (https://github.com/jasongrout/nbactions/blob/main/README.md#development-install). Yes that's true, I find it hard to understand the whole dependencies it requires without even knowing the language.

@onukwilip
Copy link

onukwilip commented Mar 31, 2023

The Readme says, you'll need JupyterLab v3 or above, do you?

@onukwilip
Copy link

Try following the steps
pip install nbactions

@onukwilip
Copy link

onukwilip commented Mar 31, 2023

Then do this in order

# Clone the repo to your local environment
# Change directory to the nbactions directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build

@kiyoon
Copy link
Author

kiyoon commented Mar 31, 2023

I installed JupyterLab with pip and yes it's the latest stable. I think this template isn't complete. So pip install nbactions doesn't work and probably if you build it yourself and package it you'll be able to upload it to pypa.

Except for the pip install, everything else seems alright. Maybe I'll need to fix some packages and dependencies to make it work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants