Skip to content

Assignment 2 - ConvolutionalNetworks - Failed to execute setup.py #297

@Kalopers

Description

@Kalopers

When I run python setup.py build_ext --inplace in the /assignment2/cs231n directory, an error will be reported:

im2col_cython.pyx:113:49: Cannot assign type 'double' to 'int'
Traceback (most recent call last):
  File "setup.py", line 12, in <module>
    setup(ext_modules=cythonize(extensions),)
  File "/home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
    cythonize_one(*args)
  File "/home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
    raise CompileError(None, pyx_file)

I also tried replacing / with //, but there is still a new error message:

[1/1] Cythonizing im2col_cython.pyx
/home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/kalo/cs231n/assignment2/cs231n/im2col_cython.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
running build_ext
building 'im2col_cython' extension
gcc -pthread -B /home/kalo/miniconda3/envs/cs231n/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/numpy/core/include -I/home/kalo/miniconda3/envs/cs231n/include/python3.7m -c im2col_cython.c -o build/temp.linux-x86_64-3.7/im2col_cython.o
In file included from /home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1969,
                 from /home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from im2col_cython.c:1219:
/home/kalo/miniconda3/envs/cs231n/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~
gcc -pthread -shared -B /home/kalo/miniconda3/envs/cs231n/compiler_compat -L/home/kalo/miniconda3/envs/cs231n/lib -Wl,-rpath=/home/kalo/miniconda3/envs/cs231n/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/im2col_cython.o -o /home/kalo/cs231n/assignment2/cs231n/im2col_cython.cpython-37m-x86_64-linu

At the same time, I have installed cython through pip install cython and can successfully import the module
Here is some information that may be helpful:
Operating System: WSL2 - Ubuntu 22.04.3 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions