Giter Site home page Giter Site logo

Installation on macOS about sierra-local HOT 4 CLOSED

poonlab avatar poonlab commented on August 19, 2024
Installation on macOS

from sierra-local.

Comments (4)

ArtPoon avatar ArtPoon commented on August 19, 2024

When calling sierralocal by absolute path, I run into the following issue:

is2882:sierra-local art$ /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/sierralocal 
3.5.5 (default, Feb  5 2018, 07:16:39) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/sierralocal", line 12, in <module>
    sys.exit(main())
TypeError: 'module' object is not callable

I encountered the same problem when building sierra-local from source in Ubuntu 18.04.1.
The problem is that main is being imported as a module, so the correct call would be main.main().
Since the sierralocal script is generated by setup.py, we have to modify the latter somehow.

from sierra-local.

ArtPoon avatar ArtPoon commented on August 19, 2024

Apparently the weird /opt path is expected behaviour from distutils, so we'll have to ignore that problem and require users to modify their PATH variable.

Changing main() to main.main() as above fixes the problem for macOS, but now we get this problem in Linux:

art@orolo:~/git/sierra-local$ sierralocal
3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0]
Traceback (most recent call last):
  File "/usr/local/bin/sierralocal", line 12, in <module>
    sys.exit(main.main())
AttributeError: 'function' object has no attribute 'main'
art@orolo:~/git/sierra-local$ cat /usr/local/bin/sierralocal 
#!/usr/bin/python3

# -*- coding: utf-8 -*-
import re
import sys

from sierralocal import main

if __name__ == '__main__':
    print(sys.version)
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main.main())

from sierra-local.

ArtPoon avatar ArtPoon commented on August 19, 2024

This is weird:

art@orolo:~/git/sierra-local$ bin/sierralocal 
3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0]
<function main at 0x7fb8867ead90>  # output of print(main)
Traceback (most recent call last):
  File "bin/sierralocal", line 13, in <module>
    sys.exit(main.main())
AttributeError: 'function' object has no attribute 'main'

art@orolo:~/git/sierra-local$ python3
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sierralocal import main
>>> main
<module 'sierralocal.main' from '/home/art/git/sierra-local/sierralocal/main.py'>

So sierralocal called via CLI loads the function and not the module, and calling it within a Python interpreter loads the module and not the function.

from sierra-local.

ArtPoon avatar ArtPoon commented on August 19, 2024

Turns out this weirdness was being caused by an older installation of sierralocal in ~/.local, which would have resulted from calling setup.py without sudo privileges. I nuked this instance and things seem back to normal. Will remove gross try..except hack from bin/sierralocal if things stay normal.

from sierra-local.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.