Thursday, January 25, 2018

Help 4 Other

  • AttributeError: module 'boto' has no attribute 'plugin' (python)
    • pip install google-compute-engine
    • Option: restart your VM
  • OSError: [Errno 1] Operation not permitted (python, mac)
    • sudo pip install --user packagename
  • xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
    • xcode-select --install
  • An unknown error occurred while loading this notebook. This version can load notebook formats or earlier. See the server log for details. (jupyter)
    • Check disk usage
  • tf.data.Dataset.from_tensor_slices gives "IndexError: list index out of range" (tensorflow)
    • the argument should be a list
    • E.g. tf.data.Dataset.from_tensor_slices('data/adult.data.csv') → tf.data.Dataset.from_tensor_slices(['data/adult.data.csv'])
  • pip -V shows 3 while python -V shows 2 (python)
  • DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size> 0` to check that an array is not empty. if diff: (sklearn)
    • It is not supposed to do something like if array: to check if an array is empty. However, sklearn does this in the 0.19.1 release.
    • Because your version of numpy is recent enough it complains and issues a warning. 
    • The problem has been fixed in sklearn's current master branch, so I'd expect the fix to be included in the next release.
    • Chcek your sklearn version
      • pip show scikit-learn
    • Ignoring the warning
      • import warnings
      • warnings.filterwarnings(module='sklearn*', action='ignore', category=DeprecationWarning)
  • Timezone setting (ubuntu)
    • For one account
      • TZ='Asia/Seoul'; export TZ
    • For system
      • sudo dpkg-reconfigure tzdata
  • no display name and no $DISPLAY environment variable (matplotlib)
    • import matplotlib
      matplotlib.use('Agg')
  • savefig is cropping the image  (matplotlib.pyplot)
    • import matplotlib.pyplot as plt
    • fig = plt.gcf()
    • fig.savefig('test.png', bbox_inches='tight')
  • Saving plot to a file (matplotlib.pyplot)
    • import matplotlib.pyplot as plt
    • fig = plt.gcf()
    • fig.savefig('test.png')
  • UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect. (matplotlib.pyplot)
    • import matplotlib.pyplot as plt
    • fig.set_tight_layout(False)
  • Query text specifies use_legacy_sql:false, while API options specify:true (pandas_gbq)
    • Specify dialect option as "standard".
  • Numerical columns become object type while reading CSV file, which is exported from bigQuery, using pandas.read_csv API (pandas)
    • It is because of the CSV file exported from bigQuery.
    • Exporting big data from bigQeury will generate more than one CSV files.
    • And each CSV file has a header.
    • While composing these CSV files to one CSV file, headers will be included.
  • ContextualVersionConflict: (requests 2.9.1 (/usr/lib/python3/dist-packages), Requirement.parse('requests>=2.18.0'), {'google-cloud-bigquery'}) (jupyter)
    • Update the requests dependency.
    • If the error still exists, then use "pip show" command to check the version of requests.
      • pip2 show requests
      • pip3 show requests
    • Specify right dependencies for Jupyter while restarting it, which is recommended, or update the dependency for related python version.
  • SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" (general)
    • This warning message is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the classpath. Placing one (and only one) of slf4j-nop.jar slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the classpath should solve the problem.
      <!-- example -->
      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-simple</artifactId>
          <version>1.7.25</version>
      </dependency>

  • ValueError: Variable X already exists, disallowed (tensorflow)
    • Use "tf.reset_default_graph()" before any code related to tensorflow
  • There is "" or "\ufeff" in the output (python)
    • Use the "utf-8-sig" encoding
      • E.g. with open('data/2.txt', encoding='utf-8-sig') as fp:
  • UnicodeDecodeError: 'cp949' codec can't decode byte X in position X: illegal multibyte sequence (python)
    • Specify the encoding
    • E.g. with open('data/2.txt', encoding='latin-1') as fp:
    • Or,
    • Save the text file with ANSI encoding
  • TypeError: parse() got an unexpected keyword argument 'transport_encoding' (gym)
    • conda install --force html5lib
    • pip install gym
  • error: object Y is not a member of package X (intellij)
  • Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? (linux)
    • ps -ef | grep apt
    • If there is apt-get or aptitude process, then kill it by usingkillcommand
    • dpkg--configure -a
  • Script does not give expected result while using "sudosu- $user /path/to/script" (linux)
    • use "sudosu$user -l -c'sh /path/to/script'" instead.
  • There are stopped jobs (linux)
    • fg
  • Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes (maven)
    • Add the following configuration to the maven-shade-plugin.
      <configuration>
          <filters>
              <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                      <exclude>META-INF/*.SF</exclude>
                      <exclude>META-INF/*.DSA</exclude>
                      <exclude>META-INF/*.RSA</exclude>
                  </excludes>
              </filter>
          </filters>
          <!-- Additional configuration. -->
      </configuration>

  • Some dependencies are not included in the JAR (maven)
    • remove the following options from maven-shade-plugin
      • <minimizeJar>true</minimizeJar>
  • Unexpected token 'non-English character' (minidev)
    • If the value consists of numbers followed by a non-English character, then it will give the unexpected token error.
      • E.g.
        • {creative_id:04 (23842564830590116),0아:1야}
        • Unexpected token 야 at position 39
    • Put the value in brackets
      • E.g. 
        • {creative_id:04 (23842564830590116),0아:(1야)}
        • {creative_id:04 (23842564830590116),0아:1(야)}
  • Strange host name while using openstack (openstack)
    • E.g. VM shows the host name as "test.novalocal", even if the host name in /etc/hosts is "test.com" or "hostname test.com" command is used to specify the host name.
    • Check the dhcp_domain at nova.conf.
    • If it is "dhcp_domain=novalocal", then change it or report it to the related team, like infra.
  • java.lang.NoClassDefFoundError: net/minidev/asm/F (minidev)
    • need "accessors-smart-1.2.jar"
  • cannot resolve symbol toDS/toDF (intellij)
    • import spark.implicits._
  • Using platform encoding (UTF-8 actually) to copy filtered resources (intellij)
    • Add the following content to the pom.xml file
    • <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>
  • refusing to merge unrelated histories (git)
    • Use '--allow-unrelated-histories'
    • E.g.
      • Go to your project folder
      • git pull origin branch_name --allow-unrelated-histories
  • java.lang.NoSuchMethodError: scala.runtime.ObjectRef.create(Ljava/lang/Object;)Lscala/runtime/ObjectRef (scala)
    • Check the scala version
    • E.g., app and compiler
  • You ($userName) are not allowed to access to (crontab) because of pam configuration. (crontab)
    • It is because the password of the user is expired.
    • Reset the password will solve the problem.
  • "'ascii' codec can't encode characters in position XXX: ordinal not in range(128)" (python)
    • add "from desktop.lib.i18n import smart_str"
    • use smart_str instead of str
  • no acceptable C compiler found in $PATH (linux)
    • CentOS
      • yum groupinstall "Development tools"
    • Ubuntu
      • apt-get install build-essential
  • gmp.h: No such file or directory (ubuntu)
    • apt-get install libgmp3-dev
  • openssl/e_os2.h: No such file or directory (ubuntu)
    • apt-get install libssl-dev
  • Unable to correct problems, you have held broken packages (apt-get)
    • aptitude install <packagename>
  • [Errno 1] _ssl.c:504: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (easy_install)
    • pip install pyopenssl
  • [Errno 101] Network is unreachable (easy_install)
    • export http_proxy=http://220.95.218.21:3128
    • export https_proxy=http://220.95.218.21:3128
  • [Errno 101] Network is unreachable (pip)
    • pip --upgrade pip
  • ffi.h: No such file or directory (linux)
    • centOS: yum -y install libffi-devel
    • ubuntu: apt-get install libffi-dev
  • openssl/opensslv.h: No such file or directory (centos)
    • yum -y install openssl-devel
  • character set collation (SQL server)
    • recreate related database or change the collation 
      • USE master;
        GO
        ALTER DATABASE MyOptionsTest
        COLLATE French_CI_AS ;
        GO openssl

        --Verify the collation setting.
        SELECT name, collation_name
        FROM sys.databases
        WHERE name = N'MyOptionsTest';
        GO
    • or, use collate like below
      • SELECT PID COLLATE Korean_100_CI_AS_WS aspid...
      • INNER JOIN #PAY_FROM_REGIST B
        ON A.Person_ID = B.Person_ID COLLATE Korean_Wansung_CI_AS
        AND A.Game_CD = B.Game_CD COLLATE Korean_Wansung_CI_AS
  • Hostname FQDN repeats the suffix twice (linux)
    • e.g.
      • hostname datanade08.net
      • hostname
        • datanade08.net
      • hostname -f
        • datanade08.net.net
    • check /etc/hostname and /etc/hosts files, and the spelling of the argument which is given to hostname command
      • e.g. the argument which is datanade08.net should be datanode08.net.
  • Failed to fetch (apt-get)
    • cd /etc/apt
    • check sources.list and files inside sources.list.d
  • date is not synchronized even if NTP is running (ntp)
    • vim /etc/ntp.conf
    • add 
      • server 222.122.134.177
      • server 222.122.169.177
    • service ntp restart
  • X must be owned by uid 0 and have the setuid bit set (chmod)
    • chmod 4755 X
  • couldn't connect: Connection refused (apt-key)
    • http://keyserver.ubuntu.com/
    • search '0x<your key>'
    • click url from result
    • copy key block to a file. e.g. key.txt
    • apt-key add key.txt
    • apt-get update
  • dpkg: warning: files list file for package 'libdbd-mysql-perl' missing (apt-get)
    • for package in $(apt-get upgrade 2>&1 | grep "warning: files list file for package '" | grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do apt-get install --reinstall "$package"; done
  • Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(<error number>, '<error message>'))' (pip)
    • pip --proxy IP:port install <name>
  • Proxy URLs must have explicit schemes (pip)
    • pip --proxy IP:port install <name>
  • gcc: error trying to exec 'cc1plus': execvp: No such file or directory (centos)
    • yum -y install gcc-c++
  • fatal error: sasl/sasl.h: No such file or directory (centos)
    • yum -y install openldap-devel
    • apt-get -y install libsasl2-dev python-dev libldap2-dev libssl-dev
  • thrift.transport.TTransport.TTransportException: Could not start SASL: Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found (centos)
    • yum -y install cyrus-sasl-plain

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.