abi / screenshot-to-code

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Home Page:https://screenshottocode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install numpy.

jooming02 opened this issue · comments

I have followed the step, and after I type "poetry install", the error is shown as below

Creating virtualenv backend-PEi2nfxd-py3.12 in C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs
Installing dependencies from lock file

Package operations: 50 installs, 0 updates, 0 removals

  • Installing certifi (2024.2.2)
  • Installing charset-normalizer (3.3.2)
  • Installing colorama (0.4.6)
  • Installing idna (3.7)
  • Installing urllib3 (2.2.1)
  • Installing filelock (3.14.0)
  • Installing fsspec (2024.3.1)
  • Installing h11 (0.14.0)
  • Installing packaging (24.0)
  • Installing pyyaml (6.0.1)
  • Installing requests (2.31.0)
  • Installing sniffio (1.3.1)
  • Installing tqdm (4.66.4)
  • Installing typing-extensions (4.11.0)
  • Installing anyio (4.3.0)
  • Installing distlib (0.3.8)
  • Installing httpcore (1.0.5)
  • Installing huggingface-hub (0.23.0)
  • Installing numpy (1.26.4): Failed

FileNotFoundError

[Errno 2] No such file or directory: 'C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy.libs\libopenblas64__v0.3.23-293-gc2f4bdbb-gcc_10_3_0-2bde3a66a51006b2b53eb373ff767a3f.dll'

at C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\pathlib.py:1013 in open
1009│ the built-in open() function does.
1010│ """
1011│ if "b" not in mode:
1012│ encoding = io.text_encoding(encoding)
→ 1013│ return io.open(self, mode, buffering, encoding, errors, newline)
1014│
1015│ def read_bytes(self):
1016│ """
1017│ Open the file in bytes mode, read it, and close the file.

Cannot install numpy.

  • Installing pillow (10.3.0)
  • Installing platformdirs (4.2.1)
  • Installing setuptools (69.5.1)

Have you tried deleting the repo and trying again from scratch? The issue seems to be with numpy installation not being successful potentially due to libopenblas not installing properly or being found on the system.

okay, after I delete and try everything again from scratch, the poetry install shows result as below now

Package operations: 0 installs, 19 updates, 0 removals

  • Downgrading idna (3.7 -> 3.6)
  • Downgrading filelock (3.14.0 -> 3.13.1)
  • Downgrading fsspec (2024.3.1 -> 2024.2.0)
  • Downgrading tqdm (4.66.4 -> 4.66.2)
  • Downgrading typing-extensions (4.11.0 -> 4.10.0)
  • Downgrading httpcore (1.0.5 -> 1.0.4)
  • Downgrading huggingface-hub (0.23.0 -> 0.21.4)
  • Downgrading pillow (10.3.0 -> 10.2.0)
  • Downgrading platformdirs (4.2.1 -> 4.2.0)
  • Downgrading setuptools (69.5.1 -> 69.2.0)
  • Downgrading identify (2.5.36 -> 2.5.35)
  • Downgrading imageio (2.34.1 -> 2.34.0)
  • Downgrading pluggy (1.5.0 -> 1.4.0)
  • Downgrading pydantic (1.10.15 -> 1.10.14)
  • Downgrading tokenizers (0.19.1 -> 0.15.2)
  • Downgrading virtualenv (20.26.1 -> 20.25.1)
  • Downgrading openai (1.25.2 -> 1.14.0)
  • Downgrading pre-commit (3.7.0 -> 3.6.2)
  • Downgrading pyright (1.1.361 -> 1.1.354)

Installing the current project: backend (0.1.0)
Warning: The current project could not be installed: No file/folder found for package backend
If you do not want to install the current project use --no-root.
If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting
package-mode = false in your pyproject.toml file.
In a future version of Poetry this warning will become an error!

And now i got 1 new problem after i type "poetry run uvicorn main:app --reload --port 7000"
the result shows
INFO: Will watch for changes in these directories: ['C:\Users\laujm\screenshot-to-code\backend\backend']
INFO: Uvicorn running on http://127.0.0.1:7000 (Press CTRL+C to quit)
INFO: Started reloader process [11340] using StatReload
Process SpawnProcess-1:
Traceback (most recent call last):
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core_init_.py", line 24, in
from . import multiarray
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core\multiarray.py", line 10, in
from . import overrides
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core\overrides.py", line 8, in
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy_init_.py", line 144, in
from numpy.config import show as show_config
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy_config_.py", line 4, in
from numpy.core.multiarray_umath import (
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core_init
.py", line 50, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  • The Python version is: Python3.12 from "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Scripts\python.exe"
  • The NumPy version is: "1.26.4"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn_subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
return self.loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\server.py", line 68, in serve
config.load()
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\config.py", line 467, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in find_and_load_unlocked
File "", line 935, in load_unlocked
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\laujm\screenshot-to-code\backend\backend\main.py", line 9, in
from routes import screenshot, generate_code, home, evals
File "C:\Users\laujm\screenshot-to-code\backend\routes\generate_code.py", line 25, in
from video.utils import extract_tag_content, assemble_claude_prompt_video
File "C:\Users\laujm\screenshot-to-code\backend\video\utils.py", line 9, in
from moviepy.editor import VideoFileClip # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\moviepy\editor.py", line 24, in
import imageio
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\imageio_init
.py", line 24, in
from .core import FormatManager, RETURN_BYTES
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\imageio\core_init
.py", line 10, in
from .util import Image, Array, Dict, asarray, image_as_uint, urlopen
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\imageio\core\util.py", line 10, in
import numpy as np
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy_init.py", line 149, in
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
INFO: Stopping reloader process [11340]

(backend-py3.12) C:\Users\laujm\screenshot-to-code\backend\backend>poetry run uvicorn main:app --reload --port 7001
INFO: Will watch for changes in these directories: ['C:\Users\laujm\screenshot-to-code\backend\backend']
INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit)
INFO: Started reloader process [24620] using StatReload
Process SpawnProcess-1:
Traceback (most recent call last):
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core_init_.py", line 24, in
from . import multiarray
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core\multiarray.py", line 10, in
from . import overrides
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core\overrides.py", line 8, in
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy_init_.py", line 144, in
from numpy.config import show as show_config
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy_config_.py", line 4, in
from numpy.core.multiarray_umath import (
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy\core_init
.py", line 50, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  • The Python version is: Python3.12 from "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Scripts\python.exe"
  • The NumPy version is: "1.26.4"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn_subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
return self.loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\server.py", line 68, in serve
config.load()
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\config.py", line 467, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in find_and_load_unlocked
File "", line 935, in load_unlocked
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\laujm\screenshot-to-code\backend\backend\main.py", line 9, in
from routes import screenshot, generate_code, home, evals
File "C:\Users\laujm\screenshot-to-code\backend\routes\generate_code.py", line 25, in
from video.utils import extract_tag_content, assemble_claude_prompt_video
File "C:\Users\laujm\screenshot-to-code\backend\video\utils.py", line 9, in
from moviepy.editor import VideoFileClip # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\moviepy\editor.py", line 24, in
import imageio
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\imageio_init
.py", line 24, in
from .core import FormatManager, RETURN_BYTES
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\imageio\core_init
.py", line 10, in
from .util import Image, Array, Dict, asarray, image_as_uint, urlopen
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\imageio\core\util.py", line 10, in
import numpy as np
File "C:\Users\laujm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\backend-PEi2nfxd-py3.12\Lib\site-packages\numpy_init.py", line 149, in
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.

I am using Python3.12 and numpy version is 1.26.4, is there any problem?

I also encountered the same problem, I hope you can provide your version information.

It seems to be a problem with the python version. I tried using version 3.10.2 and it worked.

I am using Python3.12.3 and numpy version is 1.26.4

@jooming02 in pyproject.toml, can you remove the moviepy dependency and try again from scratch? That dependency is only necessary for video input.

hi, after i used python version 3.11.5, the issue is solved. thanks a lot