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

AttributeError: module 'taichi' has no attribute 'var' #364

Closed
wang850228803 opened this issue Jan 9, 2020 · 7 comments
Closed

AttributeError: module 'taichi' has no attribute 'var' #364

wang850228803 opened this issue Jan 9, 2020 · 7 comments

Comments

@wang850228803
Copy link

I use ubutnu16.04.

I installed taichi using command:
python3 -m pip install taichi-nightly

And installing Taichi Library using command:

wget https://raw.githubusercontent.com/yuanming-hu/taichi/legacy/install.py
python3 install.py

And set the environment path:

export TAICHI_REPO_DIR=/home/wanghui/code/taichi-etc/taichi
export PYTHONPATH=TAICHI_REPO_DIR/python/:$PYTHONPATH

But when i run the example fractal.py:

[T 01/09/20 17:01:52.987] [logging.cpp:Logger@67] Taichi core started. Thread ID = 8648
Traceback (most recent call last):
  File "fractal.py", line 4, in <module>
    pixels = ti.var(dt=ti.f32, shape=(n * 2, n))
AttributeError: module 'taichi' has no attribute 'var'

Anything wrong?

@yuanming-hu
Copy link
Member

Hi,

python3 -m pip install taichi-nightly is all you need.

Please remove your taichi repo and env variables - they will fight against pip.

@HevnChin
Copy link

Hi,

python3 -m pip install taichi-nightly is all you need.

Please remove your taichi repo and env variables - they will fight against pip.

export TAICHI_NUM_THREADS=8
export TAICHI_REPO_DIR=/Users/XXXX/Documents/Taichi/taichi
export PYTHONPATH=$TAICHI_REPO_DIR/python/:$PYTHONPATH
export PATH=$TAICHI_REPO_DIR/bin/:$PATH

remove what?

@yuanming-hu
Copy link
Member

Please remove all four env vars.

@wang850228803
Copy link
Author

Share my experience here:
Environment: ubutnu16.04
Steps:

  1. upgrade python3.5 to python3.7.
  2. Download taichi_nightly-0.3.20-cp37-cp37m-manylinux1_x86_64.whl from https://pypi.org/project/taichi-nightly/#files
    (pip3 install can not install the latest version, so use this method)
  3. pip3 install taichi_nightly-0.3.20-cp37-cp37m-manylinux1_x86_64.whl
  4. python3 fractal.py
    Errors:
    [Release mode]
    Traceback (most recent call last):
    File "fractal.py", line 1, in
    import taichi as ti
    File "/usr/local/lib/python3.7/site-packages/taichi/init.py", line 1, in
    from taichi.main import main
    File "/usr/local/lib/python3.7/site-packages/taichi/main.py", line 6, in
    from taichi.tools.video import make_video, interpolate_frames, mp4_to_gif, scale_video, crop_video, accelerate_video
    File "/usr/local/lib/python3.7/site-packages/taichi/tools/video.py", line 3, in
    import taichi.core as core
    File "/usr/local/lib/python3.7/site-packages/taichi/core/init.py", line 1, in
    from .util import tc_core, build, format, load_module, start_memory_monitoring,
    File "/usr/local/lib/python3.7/site-packages/taichi/core/util.py", line 158, in
    import_tc_core()
    File "/usr/local/lib/python3.7/site-packages/taichi/core/util.py", line 31, in import_tc_core
    import taichi_core as core
    ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /usr/local/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so)

Seem that CXXABI's is not satisfied. So I give up Ubuntu. Using Mac.
Mac is so easy.
Just the command below is OK.
_python3 -m pip install taichi-nightly
python3 fractal.py_

@dongYzzz
Copy link

Traceback (most recent call last):
File "ice.py", line 3, in
ti.init(arch=ti.cuda) # Try to run on GPU
AttributeError: module 'taichi' has no attribute 'init'

how to solve this ?

@archibate
Copy link
Collaborator

Traceback (most recent call last):
File "ice.py", line 3, in
ti.init(arch=ti.cuda) # Try to run on GPU
AttributeError: module 'taichi' has no attribute 'init'

how to solve this ?

Could you try run
print(__import__('taichi').__file__)?

@archibate
Copy link
Collaborator

archibate commented May 29, 2022 via email

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

5 participants